repl.it
@basicer/

DryAged

Python

No description

fork
loading
Files
  • main.py
  • Packager files
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import remi.gui as gui
from remi import start, App
from threading import Timer

    
class MyApp(App):
    def __init__(self, *args):
        self.turn = "X"
        super(MyApp, self).__init__(*args)

    def idle(self):
        pass

    def press(self, t, c):
      if t.get_text() != " ":
        return

      t.set_text(self.turn)
      if self.turn == "X":
        self.turn = "O"
      else:
        self.turn = "X"

    def main(self):
      container = gui.GridBox(width='200', height='200', style={'margin':'100px auto'})
      self.btns = list(map(lambda l: 
        gui.Button(' ', width='90%', height='90%'),
        range(9)))

      [b.onclick.connect(self.press, container) for b in self.btns]
      x = self.btns
      container.define_grid(['abc','def','ghi'])
      d = dict((chr(ord('a') + i),x[i]) for i in range(len(x)))
      print(d)
      container.append(d)
      container.style.update({'grid-template-columns':'33% 33% 33%', 'grid-template-rows':'33% 33% 33%'})
      return container


if __name__ == "__main__":
    start(MyApp, debug=True, address='0.0.0.0', port=0,  multiple_instance=False)