from Tkinter import from sys import from thread import from threading

  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
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
from Tkinter import *
from sys import *
from thread import *
from threading import *
from time import *
class TK:
def SER(self,res,err):#ShowExpectedResults
self.res = res
self.err = err
self.root = Tk()
self.F = Frame (self.root)
self.F.pack()
self.label = Label(self.F, height = 1, text = " ")
self.label.grid(row = 0)
self.flag1 = IntVar()
self.flag2 = IntVar()
self.flag3 = IntVar()
self.flag4 = IntVar()
self.flag5 = IntVar()
self.flag6 = IntVar()
self.flags = [self.flag1,self.flag2,self.flag3,self.flag4,self.flag5,self.flag6]
self.checkbutton1 = Checkbutton(self.F,variable = self.flags[0])
self.checkbutton2 = Checkbutton(self.F,variable = self.flags[1])
self.checkbutton3 = Checkbutton(self.F,variable = self.flags[2])
self.checkbutton4 = Checkbutton(self.F,variable = self.flags[3])
self.checkbutton5 = Checkbutton(self.F,variable = self.flags[4])
self.checkbutton6 = Checkbutton(self.F,variable = self.flags[5])
self.arr = [self.checkbutton1,self.checkbutton2,self.checkbutton3,self.checkbutton4,self.checkbutton5,self.checkbutton6]
for i in range(0,len(self.res)):
self.arr[i]["text"] = self.res[i]
self.arr[i].select()
self.arr[i].grid(row=i+1, column=0, sticky = W, ipadx = 10)
self.arr[i].config (font = (13))
self.button = Button(self.F)
self.button["width"]= 18
self.button["text"]= "OK"
self.button.bind("<Button>",self.check)
self.button.grid(pady = 14)
self.root.title('Ожидаемые результаты')
self.root.resizable(0,0)
self.root.bell()
self.root.mainloop()
def check(self,event):
for i in range(0,len(self.res)):
if self.flags[i].get() == 0:
test.fail(self.err[i])
self.root.destroy()
def CL(self,res,err):
res = []
err = []
def SM(self, Text):
self.root1 = Tk()
self.F = Frame(self.root1)
self.F.pack()
self.label1 = Label (self.F, text = "")
self.label1.grid(row = 0)
self.label = Label (self.F, text = Text)
self.label.grid(row = 1, ipadx = 10)
self.label.config(font = (13))
self.root1.title('Внимание!')
self.root1.resizable(0,0)
Thread(target = self.run, name = "t2").start()
self.root1.mainloop()
def run(self):
sleep(3)
self.root1.destroy()
res = []
res.append(u"Окна имеют одинаковый размер")
res.append(u'Окна не выходят за пределы основного окна')
res.append('qwe3qwe3qwe3qwe3')
res.append('qwe4qwe4qwe4qwe4')
res.append('qwe5qwe5qwe5qwe5')
err = []
err.append('QWE1')
err.append('QWE2')
err.append('QWE3')
err.append('QWE4')
err.append('QWE5')
n = TK()
n.SM("sdfsdf")
#sleep(0.5)
n.SER(res,err)
n.SM("sdfsdf")