MCPcopy Index your code
hub / github.com/rawpython/remi / main

Method main

examples/minefield_app.py:102–160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

100 threading.Timer(1, self.display_time).start()
101
102 def main(self):
103 # the arguments are width - height - layoutOrientationOrizontal
104 self.main_container = gui.Container(margin='0px auto')
105 self.main_container.set_size(1020, 600)
106 self.main_container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
107
108 self.title = gui.Label('Mine Field GAME')
109 self.title.set_size(1000, 30)
110 self.title.style['margin'] = '10px'
111 self.title.style['font-size'] = '25px'
112 self.title.style['font-weight'] = 'bold'
113
114 self.info = gui.Label('Collaborative minefiled game. Enjoy.')
115 self.info.set_size(400, 30)
116 self.info.style['margin'] = '10px'
117 self.info.style['font-size'] = '20px'
118
119 self.lblMineCount = gui.Label('Mines')
120 self.lblMineCount.set_size(100, 30)
121 self.lblFlagCount = gui.Label('Flags')
122 self.lblFlagCount.set_size(100, 30)
123
124 self.time_count = 0
125 self.lblTime = gui.Label('Time')
126 self.lblTime.set_size(100, 30)
127
128 self.btReset = gui.Button('Restart')
129 self.btReset.set_size(100, 30)
130 self.btReset.onclick.do(self.new_game)
131
132 self.horizontal_container = gui.Container()
133 self.horizontal_container.style['display'] = 'block'
134 self.horizontal_container.style['overflow'] = 'auto'
135 self.horizontal_container.set_layout_orientation(gui.Container.LAYOUT_HORIZONTAL)
136 self.horizontal_container.style['margin'] = '10px'
137 self.horizontal_container.append(self.info)
138 imgMine = gui.Image('/my_resources:mine.png')
139 imgMine.set_size(30, 30)
140 self.horizontal_container.append([imgMine, self.lblMineCount])
141 imgFlag = gui.Image('/my_resources:flag.png')
142 imgFlag.set_size(30, 30)
143 self.horizontal_container.append([imgFlag, self.lblFlagCount, self.lblTime, self.btReset])
144
145 self.minecount = 0 # mine number in the map
146 self.flagcount = 0 # flag placed by the players
147
148 self.link = gui.Link("https://github.com/rawpython/remi",
149 "This is an example of REMI gui library.")
150 self.link.set_size(1000, 20)
151 self.link.style['margin'] = '10px'
152
153 self.main_container.append([self.title, self.horizontal_container, self.link])
154
155 self.new_game(self)
156
157 self.stop_flag = False
158 self.display_time()
159 # returning the root widget

Callers

nothing calls this directly

Calls 6

new_gameMethod · 0.95
display_timeMethod · 0.95
set_sizeMethod · 0.45
doMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected