[Tkinter-discuss] Using a window style in a Toplevel window

craf prog at vtr.net
Fri Dec 3 18:04:27 CET 2010


Hi.

I use Python 3.1 and Tkinter.ttk 8.5 on Ubuntu 9.10.

CODE:----------------------------------------------------

module:FMain.py

from tkinter import ttk
from FSecondWindow import *

class App:
    def __init__(self,master):

        button1 = ttk.Button(master,text='Show
TopLevel',command=lambda:window())
        button1.pack()

       
master = Tk()
app = App(master)
style = ttk.Style()
style.theme_use('clam')
master.mainloop()


module:FSecondWindow.py

from tkinter import *
from tkinter import ttk

def window():
    t = Toplevel()
    button2 = Button(t,text='Hello').pack()    
    

CODE EXPLANATION:-------------------------------------------

1. From the main module FMain.py call the window function that is
located in FSecondWindow module and create a toplevel window.

2.I apply a theme called 'clam' to the master window to improve the
appearance of their widgets.

QUERY:--------------------------------------------------

How I can make the toplevel window also take the theme 'clam'?

Thanks in advance.

Regards.

Cristian Abarzúa.



More information about the Tkinter-discuss mailing list