Using TCL files in Python ?

Discussion in 'Python' started by Peter Moscatt, May 11, 2005.

  1. I am reasonably new to programming in Python. [Using LINUX]

    Up until now I have been using GUI widgets supplied by 'Tkinter' but
    starting to realise that Tkinter have limited widgets.

    I have been given the lead that I should look at other sources for GUI
    widgets - namely TCL.

    I have just done a search for 'tcl' files on my 'Fedora 3' installation
    and find I have available:

    Tix8.1
    Tcl8.4
    Tk8.4

    I have never used TCL code under Python so I assume I can use widgets from
    any of these providers ?

    Where is a good resource I can use to help understand how to use TCL files
    in Python ?

    Thanks for your help.

    Pete
     
    Peter Moscatt, May 11, 2005
    #1
    1. Advertising

  2. In article <>,
    Peter Moscatt <> wrote:
    >I am reasonably new to programming in Python. [Using LINUX]
    >
    >Up until now I have been using GUI widgets supplied by 'Tkinter' but
    >starting to realise that Tkinter have limited widgets.
    >
    >I have been given the lead that I should look at other sources for GUI
    >widgets - namely TCL.
    >
    >I have just done a search for 'tcl' files on my 'Fedora 3' installation
    >and find I have available:
    >
    > Tix8.1
    > Tcl8.4
    > Tk8.4
    >
    >I have never used TCL code under Python so I assume I can use widgets from
    >any of these providers ?
    >
    >Where is a good resource I can use to help understand how to use TCL files
    >in Python ?

    .
    .
    .
    It's likely to take a few rounds to make these things clear. I'll start.

    You want more widgets than base Tkinter supplies. I understand that.
    Please read <URL: http://starship.python.net/crew/cjr/tkinter.html >.

    It is indeed useful to look to Tcl for functionality to use in Tkinter.
    I detect a couple of missteps in how you're thinking about this, though.
    First, Tcl adepts generally speak of "Tk" or "Tcl/Tk" when considering
    widgetry; in idiomatic Tcl-speak, "Tcl" itself has no widgets.

    You're right to mention Tix, Tk, and Tcl as Tcl-related installations
    Fedora includes. There actually are a few more, but you needn't concern
    yourself with them now. Of these, Tkinter already includes all the
    functionality of Tcl and Tk, and the hyperlink provided above explains
    Tix.

    What if you encounter other Tcl packages? Keep in mind that many Tcl
    packages have nothing to do with graphical user interfaces (GUIs); they
    do network programming or satellite management or locomotive control or
    other domain-specific stuff that's orthogonal to GUIing. Tkinter *can*,
    generally, exploit Tcl-coded GUI extensions. One of us will follow-up
    with a reference to that topic.
     
    Cameron Laird, May 11, 2005
    #2
    1. Advertising

  3. Peter Moscatt

    Jeff Epler Guest

    While I've never used it, there *is* a Tix module in Python which
    appears to wrap the widgets provided by Tix. In Fedora Core 2, Python
    doesn't seem to be configured to use Tix OOTB but a one-liner (that
    should be harmless elsewhere) does make it work.

    These classes are defined in the Tix module:
    ['Shell', 'Meter', 'TixSubWidget', 'ExFileSelectDialog',
    'NoteBookFrame', 'DirSelectDialog', 'Control', 'LabelEntry',
    'ButtonBox', 'ScrolledTList', 'Select', 'HList', 'Balloon', 'PopupMenu',
    'DirSelectBox', 'ComboBox', 'ScrolledWindow', 'Grid', 'CheckList',
    'DialogShell', 'Tree', 'DirList', 'ResizeHandle', 'NoteBook',
    'ListNoteBook', 'ScrolledGrid', 'FileEntry', 'ScrolledHList', 'DirTree',
    'OptionMenu', 'ScrolledText', 'LabelFrame', 'FileSelectBox',
    'ScrolledListBox', 'InputOnly', 'PanedWindow', 'StdButtonBox',
    'FileSelectDialog', 'CObjView', 'ExFileSelectBox', 'TList']

    Here's what I did to get a simple Tix widget to work:
    >>> import Tkinter, Tix
    >>> t = Tkinter.Tk()
    >>> t.tk.call("package", "require", "Tix")

    '8.1.8.4'
    >>> u = Tix.ComboBox(t)
    >>> for i in range(30): u.insert("end", "Item %d" % i)

    ...
    >>> u.pack()


    Jeff

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.6 (GNU/Linux)

    iD8DBQFCgfjuJd01MZaTXX0RAsP6AJ9V0HWPVBm73dWl4wUwhcTftNQ7qACfQupx
    GkW+1zRYrVTXQmHDk18CBZU=
    =8lbS
    -----END PGP SIGNATURE-----
     
    Jeff Epler, May 11, 2005
    #3
  4. Many thanks to all who have helped me out on this one - much appreciated.

    Pete



    On Wed, 11 May 2005 07:22:09 -0500, Jeff Epler wrote:

    > While I've never used it, there *is* a Tix module in Python which
    > appears to wrap the widgets provided by Tix. In Fedora Core 2, Python
    > doesn't seem to be configured to use Tix OOTB but a one-liner (that
    > should be harmless elsewhere) does make it work.
    >
    > These classes are defined in the Tix module:
    > ['Shell', 'Meter', 'TixSubWidget', 'ExFileSelectDialog',
    > 'NoteBookFrame', 'DirSelectDialog', 'Control', 'LabelEntry',
    > 'ButtonBox', 'ScrolledTList', 'Select', 'HList', 'Balloon', 'PopupMenu',
    > 'DirSelectBox', 'ComboBox', 'ScrolledWindow', 'Grid', 'CheckList',
    > 'DialogShell', 'Tree', 'DirList', 'ResizeHandle', 'NoteBook',
    > 'ListNoteBook', 'ScrolledGrid', 'FileEntry', 'ScrolledHList', 'DirTree',
    > 'OptionMenu', 'ScrolledText', 'LabelFrame', 'FileSelectBox',
    > 'ScrolledListBox', 'InputOnly', 'PanedWindow', 'StdButtonBox',
    > 'FileSelectDialog', 'CObjView', 'ExFileSelectBox', 'TList']
    >
    > Here's what I did to get a simple Tix widget to work:
    >>>> import Tkinter, Tix
    >>>> t = Tkinter.Tk()
    >>>> t.tk.call("package", "require", "Tix")

    > '8.1.8.4'
    >>>> u = Tix.ComboBox(t)
    >>>> for i in range(30): u.insert("end", "Item %d" % i)

    > ...
    >>>> u.pack()

    >
    > Jeff
     
    Peter Moscatt, May 12, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil Powell
    Replies:
    0
    Views:
    437
    Phil Powell
    Sep 17, 2003
  2. Michael Schlenker
    Replies:
    4
    Views:
    1,682
    Jonathan Ellis
    Jul 9, 2005
  3. C Martin

    Using Tcl extensions with Python?

    C Martin, Jul 17, 2008, in forum: Python
    Replies:
    3
    Views:
    410
    C Martin
    Jul 18, 2008
  4. salamond

    handling tcl files in ruby

    salamond, Oct 4, 2008, in forum: Ruby
    Replies:
    1
    Views:
    114
    Joel VanderWerf
    Oct 4, 2008
  5. Mumia W.

    Inline::Tcl vs. Inline::Tcl

    Mumia W., Aug 23, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    167
    Mumia W.
    Aug 23, 2006
Loading...

Share This Page