View Single Post
Old Apr 22nd, 2008, 7:18 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
Re: I am looking for

The point of having a script like this is so that you can import it, and call its functions.

At the bottom of the script, there is an example of how to call it.

   root = Tix.Tk( )
   font = askChooseFont( root )

   if font:
      print font

You want to replicate this behaviour in your original program. To do this, save this file as a script called fontchooser.py. And then add the following lines to your original program:

import fontchooser
import Tix

...

        root = Tix.Tk( )
        font = fontchooser.askChooseFont( root )

Now that you have the user's selection stored in the font variable, you can change the font via the appropriate functions in Tkinter.

If you already have a Tix.Tk instance running, you can pass that through as the "root" variable instead.
Sane is offline   Reply With Quote