Python 2.7: Thematic dialogue "general dialogue" tkinter through Ttk?

Python 2.7 (32-bit) Windows: We are experimenting with Python 2.7 support for themed Tkinter ( ttk ) for a simple graphical interface and are very impressed! One area where new theme support may have appeared is how the general OS dialogs are wrapped.

Fixed: In other words, the common MessageBox and ColorChooser have ugly Win 95-style buttons versus the thematic (rounded / gradient) buttons that usually appear in these common dialogs under XP, Vista and Windows 7. (I test on all three platforms with identical, non-thematic results).

Note. The general dialog box filedialog ( askopenfilename , askopenfilenames , asksaveasfilename , askdirectory ) is all correctly formatted.

 import tkMessageBox as messagebox messagebox.showinfo() import tkColorChooser as colorchooser color = colorchooser.askcolor( parent=root, title='Customize colors' ) 

Any ideas on what the Tkinter MessageBox and ColorChooser common dialogs ColorChooser to be OS compatible (at least on Windows XP or higher)?

+7
python user-interface windows tkinter ttk
source share
2 answers

Your observation is basically correct. I see what you mean in messagebox and colorchooser . However, my filedialogs seem to have properly rounded buttons, etc.

My recommendation for creating a message is to create your own message box using the TopLevel widget, and then determine what you need and the appropriate behavior for the different buttons (this is definitely a little more complicated than just using it, but if you really need new style buttons, this will work).

I do not think you can crack the solution for the colorchooser problem.

I at least for a minute that maybe Python 3.1 fixed this problem, but unfortunately I tried, and it is not. I suppose if you need the user to select a color, the buttons should be ugly.

+2
source share

The option to search for more convenient dialogs is to compile your script into an executable using pyinstaller . I explain this in more detail here .

tl; dr, it seems that compiling with pyinstaller allows pyinstaller to have dialog boxes with the style of the current operating system, but not user styles.

0
source share

All Articles