Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75176

Re: Exploring Python for next desktop GUI Project

References <93c42547-557b-4839-baba-9ed54120595e@googlegroups.com> <CAKJDb-NcKe5cvzjwFm24EKR63E-A4M2wkdZpY5dx4dqeTEcr0g@mail.gmail.com> <CAMw+j7KtzVkcpyqqKMPjNgqaiKzHq=yOLroe18+cnkd_rSWkNA@mail.gmail.com> <CAKJDb-MetNpEt79awj5iB_6pbSYQhcw_xQ8rzo-s6_yaz_BOhQ@mail.gmail.com> <CAMw+j7LWFq66OvS6+Qk6+K0NwCV=WpJjjy7uPYy9QyToJL7itA@mail.gmail.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date 2014-07-24 15:13 -0500
Subject Re: Exploring Python for next desktop GUI Project
Newsgroups comp.lang.python
Message-ID <mailman.12298.1406232850.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Jul 24, 2014 at 2:02 PM, Chris “Kwpolska” Warrick
<kwpolska@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()

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Exploring Python for next desktop GUI Project Noble Bell <noblebell@gmail.com> - 2014-07-24 08:57 -0700
  Re: Exploring Python for next desktop GUI Project INADA Naoki <songofacandy@gmail.com> - 2014-07-25 01:20 +0900
  Re: Exploring Python for next desktop GUI Project Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-07-24 11:22 -0500
    Re: Exploring Python for next desktop GUI Project Grant Edwards <invalid@invalid.invalid> - 2014-07-24 16:37 +0000
      Re: Exploring Python for next desktop GUI Project Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-07-24 13:17 -0500
  Re: Exploring Python for next desktop GUI Project Chris Angelico <rosuav@gmail.com> - 2014-07-25 02:18 +1000
  Re: Exploring Python for next desktop GUI Project Noble Bell <noblebell@gmail.com> - 2014-07-24 09:29 -0700
    Re: Exploring Python for next desktop GUI Project Chris Angelico <rosuav@gmail.com> - 2014-07-25 02:46 +1000
    Re: Exploring Python for next desktop GUI Project Michael Torrie <torriem@gmail.com> - 2014-07-24 15:38 -0600
  Re: Exploring Python for next desktop GUI Project Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-07-24 19:04 +0200
  Re: Exploring Python for next desktop GUI Project Chris Angelico <rosuav@gmail.com> - 2014-07-25 03:09 +1000
  Re: Exploring Python for next desktop GUI Project Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-24 19:04 +0100
  Re: Exploring Python for next desktop GUI Project Chris Angelico <rosuav@gmail.com> - 2014-07-25 04:15 +1000
  Re: Exploring Python for next desktop GUI Project Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-07-24 13:33 -0500
    Re: Exploring Python for next desktop GUI Project Grant Edwards <invalid@invalid.invalid> - 2014-07-24 21:17 +0000
  Re: Exploring Python for next desktop GUI Project Chris Angelico <rosuav@gmail.com> - 2014-07-25 04:51 +1000
    Re: Exploring Python for next desktop GUI Project Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-07-25 10:28 +1200
  Re: Exploring Python for next desktop GUI Project Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-07-24 21:02 +0200
    Re: Exploring Python for next desktop GUI Project Grant Edwards <invalid@invalid.invalid> - 2014-07-24 21:24 +0000
  Re: Exploring Python for next desktop GUI Project Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-07-24 14:10 -0500
  Re: Exploring Python for next desktop GUI Project Glenn Linderman <v+python@g.nevcal.com> - 2014-07-24 12:11 -0700
  Re: Exploring Python for next desktop GUI Project Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-24 13:32 -0600
    Re: Exploring Python for next desktop GUI Project Noble Bell <noblebell@gmail.com> - 2014-07-24 13:10 -0700
      Re: Exploring Python for next desktop GUI Project Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-07-24 13:46 -0700
  Re: Exploring Python for next desktop GUI Project Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-07-24 15:13 -0500
  Re: Exploring Python for next desktop GUI Project Michael Torrie <torriem@gmail.com> - 2014-07-24 15:24 -0600
  Re: Exploring Python for next desktop GUI Project Michael Torrie <torriem@gmail.com> - 2014-07-24 15:29 -0600
  Re: Exploring Python for next desktop GUI Project Michael Torrie <torriem@gmail.com> - 2014-07-24 15:32 -0600
  Re: Exploring Python for next desktop GUI Project ismeal shanshi <stuffstorehouse2014@gmail.com> - 2014-07-24 14:44 -0700
  Re: Exploring Python for next desktop GUI Project Terry Reedy <tjreedy@udel.edu> - 2014-07-24 19:25 -0400
    Re: Exploring Python for next desktop GUI Project wxjmfauth@gmail.com - 2014-07-26 00:48 -0700
  Re: Exploring Python for next desktop GUI Project Terry Reedy <tjreedy@udel.edu> - 2014-07-24 19:35 -0400
    Re: Exploring Python for next desktop GUI Project Noble Bell <noblebell@gmail.com> - 2014-07-25 06:37 -0700
  Re: Exploring Python for next desktop GUI Project Sturla Molden <sturla.molden@gmail.com> - 2014-07-25 20:04 +0000
  Re: Exploring Python for next desktop GUI Project CM <cmpython@gmail.com> - 2014-07-27 10:53 -0700
    Re: Exploring Python for next desktop GUI Project pecore@pascolo.net - 2014-07-29 00:00 +0200
      Re: Exploring Python for next desktop GUI Project Roy Smith <roy@panix.com> - 2014-07-28 18:01 -0400
        Re: Exploring Python for next desktop GUI Project pecore@pascolo.net - 2014-07-29 21:47 +0200

csiph-web