Manavalan Gajapathy
Manavalan Gajapathy

Reputation: 4089

Python 2.7 - ttk module seemingly not working in Windows 8.1

My application's GUI is Tkinter based and it is quite functional. I have been trying to use ttk to make it look more modern. I use Python 2.7 in Windows 8.1. Importing ttk goes without error and coding including ttk in the script runs without error. However, the resulting interface looks almost same as the one done only with Tkinter. This is especially true for the buttons. I tried different ttk styles and they almost look same or some worse than Tkinter-only based interface.

Tkversion in my system is 8.5. I have been using ttk that comes as part of Python 2.7 itself. I attempted installing pyttk-0.3.2 from https://pypi.python.org/pypi/pyttk but its installation always fails even after several attempts.

My questions are these:

Also, can you please recommend a software (hopefully minimal - meaning not requiring to install too many external libraries) that is coded in Python 2.7 using Tkinter and ttk? This would help me as a point of reference on testing ttk in my computer.

Thanks in advance!

Updated with code and screenshot: (in response to @Bryan Oakley)

Here is the code I use:

from Tkinter import *
import ttk

root = Tk()
root.geometry("")
root.title("classic")

button_1 = Button(root, text='Tkinter')
button_1.grid(row=0, column=0, padx=10, pady=10)

button_2 = ttk.Button(root, text='ttk')
button_2.grid(row=0, column=1, padx=10, pady=10)

style = ttk.Style()
style.theme_use('classic')

root.mainloop()

Seven ttk theme styles are available: 'winnative', 'clam', 'alt', 'default', 'classic', 'vista', 'xpnative'.

Here is the screenshot (updated on Apr 20) for each type:

Themes- Screenshot

Upvotes: 3

Views: 2192

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385900

Your question doesn't mention it, but you should also have a "vista" theme available. Try using that theme. You might also try not setting the theme, and rely on the default (which I think should be "vista").

To address your specific questions:

Is there a known problem of Python 2.7's module ttk not playing nice under Windows 8.1?

Not that I am aware of.

Is there a possibility of error in ttk libraries even though it never results in error during import or running code with ttk?

That is highly unlikely, but apparently it's possible.

Do i really need to install pyttk-0.3.2?

No, you don't.

Upvotes: 1

Related Questions