tkinter问题
from tkinter import *class getmain:
def __init__(self):
self.root = Tk()
self.root.mainloop()
self.maincode()
def maincode(self):
self.urlframe = LabelFrame(self.root,text="input")
self.urllabel = Label(self.urlframe,text="url is: ")
self.urllabel.pack()
self.urllabel.grid(row=1,column=1)
self.url = Entry(self.urlframe)
self.url.grid(row=1,column=2)
self.urlframe.pack()
if __name__ == "__main__":
bfi = getmain()
bfi.root.mainloop()
为什么窗口显示不出来内容? 还有函数调用写在mainloop后面??我震惊了
from tkinter import *
class getmain:
def __init__(self):
self.root = Tk()
self.maincode()
self.root.mainloop()
def maincode(self):
self.urlframe = LabelFrame(self.root,text="input")
self.urllabel = Label(self.urlframe,text="url is: ")
self.urllabel.pack()
self.urllabel.grid(row=1,column=1)
self.url = Entry(self.urlframe)
self.url.grid(row=1,column=2)
self.urlframe.pack()
if __name__ == "__main__":
bfi = getmain() 本帖最后由 xiaosi4081 于 2020-7-21 12:30 编辑
qiuyouzhi 发表于 2020-7-21 12:04
还有函数调用写在mainloop后面??我震惊了
刚开始学面向对象,有些慌,忘记了把mainloop放到后面去{:10_250:} xiaosi4081 发表于 2020-7-21 12:09
刚开始学面向对象
???
我说的是tkinter的问题啊 qiuyouzhi 发表于 2020-7-21 12:27
???
我说的是tkinter的问题啊
改了
页:
[1]