Serban Razvan
Serban Razvan

Reputation: 4490

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").pack()
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.

Upvotes: 0

Views: 590

Answers (1)

jcfollower
jcfollower

Reputation: 3158

Instead of

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

try

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

Upvotes: 3

Related Questions