开发者

Two related windows not displaying properly

Running this code on my linux mint 11 with Python 2.6 would normally lead to creating 2 windows, each of them having a frame with a Button:

from Tkinter import *

root = Tk()

boot = Toplevel()
frame = Frame(root).pack()
button = Button(frame,text="button1").p开发者_Go百科ack()
fr = Frame(boot).pack()
but = Button(fr,text="button2").pack()

root.mainloop()

But running the code gives me one window (probably the root) with both buttons and another tiny window which has no frame and no button.


Instead of

fr = Frame(boot).pack()
but=Button(boot, text=...

try

fr = Frame(boot)
fr.pack()
but=Button(boot, text= ...)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜