您好,我的显示器的最大分辨率为1366 x768。我有以下代码显示几个变量。我的代码有两个问题。
GUI仅显示12个变量,但我需要显示15个。我无法将GUI扩展到超过特定点以查看其余部分。所有这15个变量都显示在我的朋友监视器中,该监视器显示1920 x1080。
我为滚动条添加的代码也不起作用,因此我已将其注释掉。
from tkinter import *
from tkinter import ttk
class Application(Frame):
def widgets(self):
self.tabcontrol = ttk.Notebook(self)
self.tab1 = ttk.Frame(self)
#self.xscrollbar = Scrollbar(self.tab1, orient = HORIZONTAL)
#self.tab1.configure(xscrollcommand = self.xscrollbar.set)
self.tabcontrol.add(self.tab1, text = "Tab-1")
self.tabcontrol.pack(expand =1, fill = "both")
#self.xscrollbar.grid(row = 2, column =0, sticky = N+S+E+W)
#self.xscrollbar.configure(command = self.tab1.xview)
self.photo = PhotoImage(file = "Test.PNG")
self.title = Label(self.tab1, image = self.photo)
self.title.grid(row= 0, column=0, columnspan = 15, rowspan =1)
self.L1 = Label(self.tab1, text = "A", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =0)
self.L2 = Label(self.tab1, text = "B", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =1)
self.L3 = Label(self.tab1, text = "C", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =2)
self.L4 = Label(self.tab1, text = "D", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =3)
self.L5 = Label(self.tab1, text = "E", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =4)
self.L6 = Label(self.tab1, text = "F", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =5)
self.L7 = Label(self.tab1, text = "G", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =6)
self.L8 = Label(self.tab1, text = "H", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =7)
self.L9 = Label(self.tab1, text = "I", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =8)
self.L10 = Label(self.tab1, text = "J", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =9)
self.L11 = Label(self.tab1, text = "K", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =10)
self.L12 = Label(self.tab1, text = "L", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =11)
self.L13 = Label(self.tab1, text = "M", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =12)
self.L14 = Label(self.tab1, text = "N", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =13)
self.L15 = Label(self.tab1, text = "O", fg = "white", bg = "steel blue", font = "Helvetica 10 bold").grid(row=1, column =14)
def __init__(self, initial):
super(Application, self).__init__(initial)
self.grid()
self.widgets()
Window = Tk()
Tool = Application(Window)
Window.mainloop()
答案 0 :(得分:0)
找到解决方案!
Use try Catch! - Set a flag (array) and check in any subsequent tests if it
is set to Fail then skip the test.
try{
var pageTitle = await ndp.currTitle();
await pageTitle.should.equal('Google');
}
catch (e) {
testStatus[0] === 'Fail'
assert.fail('1st Test Failed due to error --> ' +e);
}
<<Subsequent Test>>
if (testStatus[0] === 'Fail')
{
this.skip();
}
you can also check this flag for any other test too in the same module,
testStatus[0], testStatus[1] etc wt different status. Make it dynamic using
a counter etc...