我正在使用breezypythongui
,并且已编写此代码来匹配示例文件,但无法获取它以在屏幕上生成窗口。找到here
breezypythongui.py
的链接
from breezypythongui import EasyFrame
class ButtonDemo(EasyFrame):
def __init__(self):
EasyFrame.__init__(self, title = "Button Demo")
self.label = self.addLabel(text = "hello world!", row = 0, column = 0, columnspan = 2, sticky = "NSEW")
self.clearBtn = self.addButton(text = "Clear", row = 1, column = 0, command = self.clear)
self.restoreBtn = self.addButton(text = "Restore", row = 1, column = 1, command = self.restore, state = "disabled")
def clear(self):
self.label["text"] = ""
self.clearBtn["state"] = "disabled"
self.restoreBtn["state"] = "normal"
def restore(self):
self.label["text"] = "Hello world!"
self.clearBtn["state"] = "normal"
self.restoreBtn["state"] = "disabled"
def main():
ButtonDemo().mainloop()
if __name__ == " main ":
main()
没有回溯或错误代码
答案 0 :(得分:0)
在代码“ main”中缺少下划线,因此我的更正代码是:
if __name__ == " main ":
main()
if __name__ == "__main__":
main()