Integrate Tile into Tkinter

K

Kevin Walzer

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Are there any plans to integrate the Tile extension from Tk into
Tkinter? This theming extension allows native look and feel under
Windows XP and OS X, in particular, and adds a lot of theming
flexibility to Tk apps. In fact, it would bring Tkinter pretty much in
line with wxPython in terms of a native "look" on various platforms,
though wx still has a larger set of core widgets. I've seen only a
little discusison about Tile in Python circles, but it's one of the most
important advances going on with Tcl/Tk these days. Anyway, I'm just
curious, as I have some experience with Tcl/Tk and am learning Python.

- --
Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.smallbizmac.com
http://www.kevin-walzer.com
mailto:[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBddb9JmdQs+6YVcoRAgdKAJ4v99f7qGXHEaoFTS249cvFNIXArwCdFki+
f2Io7rRlF6IHbPsVTHAQAzY=
=s+ao
-----END PGP SIGNATURE-----
 
J

Jeremy Bowers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Are there any plans to integrate the Tile extension from Tk into
Tkinter? This theming extension allows native look and feel under
Windows XP and OS X, in particular, and adds a lot of theming
flexibility to Tk apps. In fact, it would bring Tkinter pretty much in
line with wxPython in terms of a native "look" on various platforms,
though wx still has a larger set of core widgets. I've seen only a
little discusison about Tile in Python circles, but it's one of the most
important advances going on with Tcl/Tk these days. Anyway, I'm just
curious, as I have some experience with Tcl/Tk and am learning Python.

Hey, thanks for the pointer. I've been waiting for this for a while, but
not moving in the "Tk circles" I didn't know how close it was to done.

Assuming you've installed Tile such that Tk can find it, try this:

--------------

from Tkinter import *

root = Tk()
root.tk.call('package', 'require', 'tile')
root.tk.call('namespace', 'import', '-force', 'ttk::*')
root.tk.call('tile::setTheme', 'alt')
v = IntVar()
Radiobutton(root, text="Hello", variable=v, value=1).pack()
Radiobutton(root, text="There", variable=v, value=2).pack()

root.mainloop()


--------------

By no means is this a good program in any sense of the term; in particular
I don't know if the "root.tk.call"s can be written more concisely and
the forced import looks dangerous. But at least on my system, that works
as expected and at least demonstrates that you can reach tile from
Tkinter with no need to wait for someone.

(That is *so* going into my Tk programs.)
 
E

Eric Brunel

Kevin said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Are there any plans to integrate the Tile extension from Tk into
Tkinter? This theming extension allows native look and feel under
Windows XP and OS X, in particular, and adds a lot of theming
flexibility to Tk apps. In fact, it would bring Tkinter pretty much in
line with wxPython in terms of a native "look" on various platforms,
though wx still has a larger set of core widgets. I've seen only a
little discusison about Tile in Python circles, but it's one of the most
important advances going on with Tcl/Tk these days. Anyway, I'm just
curious, as I have some experience with Tcl/Tk and am learning Python.

It should just be a matter of patience, since - according to
http://wiki.tcl.tk/11075 - the tile package will integrated in tk8.5 (originally
planned for late summer '04, but not "officially" available yet...). And Tkinter
maintainers out there usually do a great job and quickly integrate tk extensions
once they are released.
 
J

Jon Perez

Speaking of Tkinter, I noticed that there has
been progress with Fredrik Lundh's Tkinter 3000/
Widget Construction Kit project. Specifically,
you can now make your own Tkinter widgets from
scratch using pure Python. Performance actually
seems to be quite good.

http://www.effbot.org/zone/wck.htm

--- quote from WCK page ----

The Widget Construction Kit (WCK) is an extension
API that allows you to implement all sorts of custom
widgets, in pure Python. Creating a new widget can be
as simple as:

from WCK import Widget

class HelloWidget(Widget):

def ui_handle_repair(self, draw, x0, y0, x1, y1):
font = self.ui_font("black", "times")
draw.text((0, 0), "hello, world!", font)
 
F

Fredrik Lundh

Jon said:
Speaking of Tkinter, I noticed that there has
been progress with Fredrik Lundh's Tkinter 3000/
Widget Construction Kit project. Specifically,
you can now make your own Tkinter widgets from
scratch using pure Python.

footnote: this functionality has been available since early 2001.

</F>
 
A

andrea valle

Ok, I know it's basic, but I cannot find a reference...
How can I set the position on the screen of a frame in Tkinter?

Thanks a lot
-a-


Andrea Valle
Laboratorio multimediale "G. Quazza"
Facoltà di Scienze della Formazione
Università degli Studi di Torino
(e-mail address removed)
 
E

Eric Brunel

andrea said:
Ok, I know it's basic, but I cannot find a reference...
How can I set the position on the screen of a frame in Tkinter?

First, according to Tkinter terminology, a frame is not a window. A window is
called a Toplevel in Tkinter (I see a lot of examples building Tkinter
applications by inheriting from Frame; don't do that! Or you will have big
problems when trying to do things on the actual window, i.e. the Toplevel
instance. If you really want to sub-class something, sub-class Toplevel or Tk
for the main window)

So, once you have your Toplevel instance, the method positionning/sizing the
window is calledgeometry, to which you pass a string formatted like
'[WxH][+X+Y]', where W and H are the width and height you want for your window,
and X and Y its coordinates. Example:
''

The first root.geometry sets the window's dimensions only, the second one its
position only, and the third one its dimensions and position.

HTH
 
A

andrea valle

Thanks a lot
First, according to Tkinter terminology, a frame is not a window. A
window is called a Toplevel

Sorry, I was in a hurry...

Could you please tell me where to find a complete reference for
Tkinter? Maybe from a Tk site?
Thanks

-a-

So, once you have your Toplevel instance, the method
positionning/sizing the window is calledgeometry, to which you pass a
string formatted like '[WxH][+X+Y]', where W and H are the width and
height you want for your window, and X and Y its coordinates. Example:
''

The first root.geometry sets the window's dimensions only, the second
one its position only, and the third one its dimensions and position.

HTH
Andrea Valle
Laboratorio multimediale "G. Quazza"
Facoltà di Scienze della Formazione
Università degli Studi di Torino
(e-mail address removed)
 
E

Eric Brunel

andrea said:
Thanks a lot

You're welcome.

[snip]
Could you please tell me where to find a complete reference for Tkinter?
Maybe from a Tk site?

An on-line version of the tcl/tk man pages is available here:
http://www.tcl.tk/man/

Fredrik Lundh's introduction to Tkinter is also quite comprehensive, and
actually describes Tkinter, not tcl/tk; so you won't have to guess how the tcl
commands were translated to Python methods:
http://www.pythonware.com/library/tkinter/introduction/index.htm

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top