سؤال

I'm trying to change the look of my Tkinter application but not having much luck. I discovered the tile package and looked around the sites that I've found but nothing I try works. The code for importing that I've used is the following:

import Tkinter as Tk
import ttk
import Tile

win1 = Tk()
win1.call('namespace', 'import', '-force', 'ttk::*')
win1.call('tile::setTheme', 'xpnative')

Error: _tkinter.TclError : invalid command name 'tile::setTheme'

I'm really stuck on how to get this working for any type of design change to Tkinter. I want my interface to look nice!

Would appreciate any help given, thank you!

هل كانت مفيدة؟

المحلول

Tile is just an old version of the ttk package. You don't need it if you already have access to ttk.

For information on how to configure styles, see the tkdocs tutorial on styles

نصائح أخرى

Even though it's not linked to the Tile package. I have found how to obtain the 'xpnative' theme.

Simply:

from Tkinter import *
import ttk

s = ttk.Style()
s.theme_use('xpnative')

Then you may have to insert ttk.[widgethere] for various widgets but it appears to work nevertheless.

Have fun! (Python Version 2.6)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top