On Thu, Jul 24, 2014 at 2:02 PM, Chris “Kwpolska” Warrick
<kwpol...@gmail.com> wrote:
> Pretty much everyone in the world hates Tcl and Tk.  Ask your favorite
> search engine for some results.

Whee, I'm an alien! ;)

I'm not saying Tk is the best thing since sliced bread, I just don't
see what so many people seem to hate about it.

> i’ve tried to write a Tkinter thing once.  I don’t have a copy anymore
> (consciously deleted), but I vaguely remember some issues with widgets
> that do not work.  I also remember that the list of widgets is quite
> small and not enough for many projects.

I have had no issues with widgets not working.  I will admit that the
widget set is fairly small, though.  You can get more from Tix (which
is also distributed with tkinter), but I haven't had any need for that
yet.

> The best way to handle this is just choose one of the two (wxwidgets
> chose GTK 2, for example) and be considered native enough by most, as
> people don’t really mind mixing them (as there are no good Qt web
> browsers, and VLC uses Qt and not GTK)

That's fair, and I agree that Tk should probably provide "close to
GTK" and "close to QT" themes for ttk[1].  As I understand it, though,
ttk gives almost complete control over the look of individual widgets,
so if you really don't like how your widget looks, change it!

> ttk on Linux doesn’t change a thing.  It still uses the ugly, ancient,
> motif-esque style:
>
> https://www.google.com/search?q=tk+linux&tbm=isch
>
> (also, off by 10 years, motif is actually from the 1980s.)

Motif is indeed ugly, but your search for 'tk linux' doesn't tell me
anything about 'ttk linux'.  I would be interested in the results of
the script below on Linux, which I may or may not be able to try for
myself later (but can't right now).

-- 
Zach

[1] Such themes might already exist, I haven't checked.  If anyone
wants to see what themes are available and how they look, try this
(2/3 compatible, also attached in case Gmail messes it up):


import sys

try:
    import tkinter as tk
    from tkinter import ttk
except ImportError:
    import Tkinter as tk
    import ttk

class App(object):
    def __init__(self, root):
        self.root = root
        self.root.title('Theme tester')
        self.info_label = ttk.Label(self.root,
            text="Python {}.{} with Tcl/Tk {} on {}".format(
                sys.version_info[0], sys.version_info[1],
                self.root.tk.eval('info patchlevel'),
                sys.platform))
        self.info_label.pack()
        self.theme_idx = 0
        self.change_btn = ttk.Button(self.root,
                                     text='Change theme',
                                     command=self.change_theme
                                     )
        self.change_btn.pack()
        self.rb_var = tk.StringVar(self.root)
        self.radiobtn = ttk.Radiobutton(self.root,
                                        text='Radio button option 1',
                                        variable=self.rb_var,
                                        value='1')
        self.radiobtn.pack()
        self.radiobtn2 = ttk.Radiobutton(self.root,
                                         text='Radio button option 2',
                                         variable=self.rb_var,
                                         value='2')
        self.radiobtn2.pack()
        self.checkbtn = ttk.Checkbutton(self.root, text='Checkbutton')
        self.checkbtn.pack()
        self.entry = ttk.Entry(self.root)
        self.entry.insert(0, 'Entry')
        self.entry.pack()

        self.style = ttk.Style(self.root)
        self.available_themes = self.style.theme_names()

        self.theme_label = ttk.Label(self.root, text='Platform default')
        self.theme_label.pack()

    def change_theme(self):
        try:
            theme = self.available_themes[self.theme_idx]
        except IndexError:
            theme = self.available_themes[0]
            self.theme_idx = 0
        self.style.theme_use(theme)
        self.theme_label.configure(text=theme)

        self.theme_idx += 1

root = tk.Tk()
app = App(root)
root.mainloop()
import sys

try:
    import tkinter as tk
    from tkinter import ttk
except ImportError:
    import Tkinter as tk
    import ttk

class App:
    def __init__(self, root):
        self.root = root
        self.root.title('Theme tester')
        self.info_label = ttk.Label(self.root,
            text="Python {}.{} with Tcl/Tk {} on {}".format(
                sys.version_info[0], sys.version_info[1],
                self.root.tk.eval('info patchlevel'),
                sys.platform))
        self.info_label.pack()
        self.theme_idx = 0
        self.change_btn = ttk.Button(self.root,
                                     text='Change theme',
                                     command=self.change_theme
                                     )
        self.change_btn.pack()
        self.rb_var = tk.StringVar(self.root)
        self.radiobtn = ttk.Radiobutton(self.root,
                                        text='Radio button option 1',
                                        variable=self.rb_var,
                                        value='1')
        self.radiobtn.pack()
        self.radiobtn2 = ttk.Radiobutton(self.root,
                                         text='Radio button option 2',
                                         variable=self.rb_var,
                                         value='2')
        self.radiobtn2.pack()
        self.checkbtn = ttk.Checkbutton(self.root, text='Checkbutton')
        self.checkbtn.pack()
        self.entry = ttk.Entry(self.root)
        self.entry.insert(0, 'Entry')
        self.entry.pack()

        self.style = ttk.Style(self.root)
        self.available_themes = self.style.theme_names()

        self.theme_label = ttk.Label(self.root, text='Platform default')
        self.theme_label.pack()

    def change_theme(self):
        try:
            theme = self.available_themes[self.theme_idx]
        except IndexError:
            theme = self.available_themes[0]
            self.theme_idx = 0
        self.style.theme_use(theme)
        self.theme_label.configure(text=theme)

        self.theme_idx += 1

root = tk.Tk()
app = App(root)
root.mainloop()
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to