Hi.
running Linux, with python3.6
I am trying to learn how to put a frame on a second window. I get no
errors showing in the terminal, and I get no traceback.
What is happening is that the contents of the frame appear in the master
window. I was expecting them to show in the second window. Also I
expected the frame to be sunken, but there is no obvious signs of the
frame, not even a colored background.
What am I doing wrong?
Thank you, Chris Roy-Smith
here is my code:
#! /usr/bin/python3
from tkinter import *
def NewWindow():
sw=Toplevel(master)
sw.title('New Window')
Label(sw, text='new window').grid(row=0, column=0)
sframe=Frame(sw, relief=SUNKEN, bg='red').grid(row=1, column=0)
Label(sframe, text='Label in a frame').grid(row=2, column=0)
Label(sframe, text='Second label in this frame').grid(row=3, column=0)
Button(sw, text='close window', command=sw.destroy).grid(row=5,
column=0)
master=Tk()
master.title('Master Window')
Button(master, text='open window', command=NewWindow).grid(row=1, column=1)
Button(master, text='quit', command=master.destroy).grid(row=2, column=1)
Label(master, text="learning").grid(row=0, column=0)
master.mainloop()
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor