-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
executable file
·51 lines (40 loc) · 1.14 KB
/
start.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
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
# coding=utf-8
from random import randint
import wx
import wx.xrc
from gui import MainFrameBase
class MainFrame(MainFrameBase):
def onRand(self, event):
row = 0
col = 0
while row < self.m_grid1.GetNumberRows():
while col < self.m_grid1.GetNumberCols():
random_num = randint(0, 11)
self.m_grid1.SetCellValue(row, col, "%d" % random_num)
col += 1
row += 1
col = 0
def onSum(self, event):
row = 0
col = 0
sum = 0
while row < self.m_grid1.GetNumberRows():
while col < self.m_grid1.GetNumberCols():
try:
sum = sum + int(self.m_grid1.GetCellValue(row, col))
except:
pass
col += 1
row += 1
col = 0
self.m_staticText_Sum.SetLabel("Сумма = " + "%d" % sum)
def OnCloseFrame(self, event):
self.Destroy()
def main():
app = wx.App(False)
frame = MainFrame(None)
frame.Show(True)
app.MainLoop()
if __name__ == '__main__':
main()