[Tutor] TKinter and things over Linux

joe_schmoe geek_show at dsl.pipex.com
Sun Apr 17 00:13:22 CEST 2005


Alberto Troiano wrote:
> Hi everyone
>  
> Sorry to bother you again but I don't know where else to go
>  
> I recently switch to Linux Red Hat AS 3.0 because I have to make a 
> daemon to run in this OS and I'm having a few problems
>  
> I've struggle to replace Python 2.2(machine default) to 2.3.4 (tough but 
> could)
>  
> Now I want to program a GUI with Tkinter but when I put the sentence 
> from TKinter import *, it tells me that it doesn't find the module 
> Tkinter. I have downloaded Python 2.3.4 from python.org and follow the 
> steps.
>  
> Secondly I want to know how to run the .py programs and which is the 
> extension of a GUI in Linux (I know that for Windows is .pyw but it 
> doesn't know what are these in Linux)
>  
> Then is there an IDLE for Linux so I can run the program without having 
> to go to the shell????????
>  
> Thanks a lot
>  
> Regards
>  
> Alberto
> 
> ------------------------------------------------------------------------
> 
> Hi everyone
>  
> I recently switch to Linux Red Hat AS 3.0 because I have to make a 
> daemon to run in this OS and I'm having a few problems
>  
> I've struggle to replace Python 2.2(machine default) to 2.3.4 (tough but 
> could)
>  
> Now I want to program a GUI with Tkinter but when I put the sentence 
> from TKinter import *, it tells me that it doesn't find the module 
> Tkinter. I have downloaded Python 2.3.4 from python.org and follow the 
> steps.
>  
> Secondly I want to know how to run the .py programs and which is the 
> extension of a GUI in Linux (I know that for Windows is .pyw but it 
> doesn't know what are these in Linux)
>  
> Then is there an IDLE for Linux so I can run the program without having 
> to go to the shell????????
>  
> Thanks a lot
>  
> Regards
>  
> Alberto
> 
> 
Hi Alberto

I am curious why you are using RH3.0 - be aware that many of the system 
calls of later Python releases may expect libraries that aren't part of 
the distro you are using. I couldn't say for sure, but I'd anticipate 
some limits to backwards compatibility.

Anyway, in answer to your question. To find the Tkinter modules, you 
should probably enter "whereis tkinter" at the command line and then 
re-install Python with that in its path, or re-install TKinter with the 
python installation path. RH has a tendency to Red Hat-ise the file 
hierarchy somewhat, so it could just be a case that one or the other 
doesn't know how to find its libraries.

I couldn't tell you what the extensions for GUIs are. Perhaps 
www.python.org might have some clues for that. However, to run python 
programs from the shell, if you have added the she-bang (the #!/bin/sh 
part) as the first line of your program, then just enter python 
my_program.py at the prompt and watch it run!!

I think that idle tends to be the native IDE for python, but there are 
others you could use, some of which might provide you with a GUI IDE so 
you don't have to use the command line. In the interim however, just 
enter idle at the command line and a new window will be spawned with the 
following:
=========================

Python 2.4.1 (#1, Apr  6 2005, 09:36:35)
[GCC 3.3.4] on linux2
Type "copyright", "credits" or "license()" for more information.

     ****************************************************************
     Personal firewall software may warn about the connection IDLE
     makes to its subprocess using this computer's internal loopback
     interface.  This connection is not visible on any external
     interface and no data is sent to or received from the Internet.
     ****************************************************************

IDLE 1.1.1
 >>>

=========================

To use a text editor just enter ctrl + n in this window and then to run 
it, save it as *.py and hit F5 to run in the idle window.

HtH

/j


More information about the Tutor mailing list