Have you heard of Python?
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.
Check √
How about Tkinter (the Tcl/TK GUI interface for Python)?
Tkinter is a Python binding to the Tk GUI toolkit, as we showed you below with previous relevant Python Tkinter Primer Tutorial. It is the standard Python interface to the Tk GUI toolkit[1] and is Python’s de facto standard GUI,[2] and is included with the standard Windows and Mac OS X install of Python.
So today (with an Apache/PHP/MySql local MAMP web server environment) we work off the install issues presented at Python Tkinter Install Tutorial and the advice at Apache WebServer on Mac and The Three Pās Primer Tutorial regarding the co-existance PHP (server-side HTML creation) can have with Python (as executable CGI program) that, now, can use Tkinter GUI functionality … yayyyyyyyyyyyyyyyyyyy! … to be able to run a Python Tkinter web application webpage.
By the way, the tkinter_filebrowser_test.cgi programming Python code used is the same as tkinter_filebrowser_test.py, as for the previous tutorial. Curiously, it may not run for you in Python 3.3(?!)
Previous relevant Python Tkinter Install Tutorial is shown below.
Have you heard of Python?
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.
Check √
How about Tkinter (the Tcl/TK GUI interface for Python)?
Tkinter is a Python binding to the Tk GUI toolkit, as we showed you below with previous relevant Python Tkinter Primer Tutorial. It is the standard Python interface to the Tk GUI toolkit[1] and is Python’s de facto standard GUI,[2] and is included with the standard Windows and Mac OS X install of Python.
But what if you have Python installed but no Tkinter (GUI)? … to test for this … see … TkInter – Python Wiki, as is often the case on Apache/PHP web server setups.
If you get stuck at the import line of code with an error message you don’t have a compiled version of Python where a Tkinter module has been compiled into it. Before you panic, another check is, do you have two versions of Python co-existing, the more recent of which is not the default … try the same thing at the command line with python2.7 or python3.3, rather than python … Murphy’s law being what it is … a plot by Murphy’s enemies … it is unlikely this simple thought resolves your Tkinter usage issue.
You may get errors that talk about the environment variable DISPLAY … well, this means you have no GUI framework on which Tkinter can play? How could you? So part of what you will need is Xterm, or the more modern replacement Xquartz, or the more elaborate GNOME Desktop suite of software.
The findings for me were that both were needed … a sad scenario indeed, if you want to develop some interesting graphical Python software.
From here, the (Linux, in our case) environment becomes important (as you learn the more you get into the OpenSource world) … and the idea that you should not proceed if you are happy with your current Python, for what you aim to achieve … but … when looking for solutions to this problem on the Internet add your environment “word” to the search words … eg. (for me) … “Python Tkinter install” “CentOS”
Now will show you some useful links (thanks, OpenSource community) that may help point you in the right direction (environmental issues preclude me from giving more precise exact advice):
- How to install Python 2.7 and Python 3.3 on CentOS 6 | Too Much Data … ended up installing Python 3.3 as shared library, co-existing with the default Python (which is 2.6) … so was useful in my case
- python3-tkinter-3.3.0-1.puias6.i686.rpm CentOS 6 Download … taught me that after installing python3.3 and finding the Tkinter tests failed, that yum install python3-tkinter would help, and it did, but the other bits of this webpage’s advice were not useful for my case
- Tkinter: "Python may not be configured for Tk" – Stack Overflow … taught me that I would need to do yum install tk-devel (which did happen for me, at one stage)
- TkDocs – Tk Tutorial … may be useful, and should be useful, but maybe not for up to date scenarios … not used by me much
- CentOS • View topic – [SOLVED] where is xterm? … good for advice regarding Xterm (or Xquartz or GNOME Desktop) if last of your issues is that DISPLAY error and you want to install the solution locally (see mention of remote idea in last link below)
- HowTos/VNC-Server – CentOS Wiki … you may need, for a local graphics-installed solution to have users who can use Xterm (or Xquartz or GNOME Desktop) as a default environment, or have it switchable, to read this link’s advice (this brings into play discussions regarding VNC and PuTTY, but this, perhaps, should be for another day)
- FrontPage – Tkinter Wiki … is more useful after you get the install correct
- linux – Trying to open a GUI from a remote server using Mac but not succesfully – Unix & Linux Stack Exchange … the thoughts here are for another time, involving ssh tunnelling and X11 forwarding to help create your “graphics source” remotely (perhaps) to help you out with a server, maybe, that doesn’t have Xterm nor Xquartz nor a GNOME Desktop ( in such cases to continue on, to find a use for Tkinter you’ll need something like “export DISPLAY=[ip address of client allowing X11 forwarding]:0” )
By the way, the test.py programming Python code used is the same as tkinter_filebrowser_test.py, as for the previous tutorial. Curiously, it may not run for you in Python 3.3(?!)
Will leave with a general Python Tcl/Tk reference link here.
Previous relevant Python Tkinter Primer Tutorial is shown below.
Have you heard of Python?
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.
Check √
How about Tkinter (the Tcl/TK GUI interface for Python)?
Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit[1] and is Python’s de facto standard GUI,[2] and is included with the standard Windows and Mac OS X install of Python.
Check √ (we hope)
Have used it for Games Programming and it is great at parsing XML via the SAX API.
Python has some really interesting data structures such as tuples, lists, sets, dictionaries for instance … read more here.
In this primer tutorial you can see Tkinter being used by Python to display a file browser dialog, from which you can select a jpeg file to display with the default operating system image application (in our case, on a Mac laptop, this is Preview).
Here is another Python tutorial called Python Processing Directory Filespec Primer Tutorial.
Useful tutorials helping with this tutorial were
Link to Python information … from Wikipedia … where quote up the top resides.
Link to Tkinter information … from Wikipedia … where quote up the top resides.
Link to some Python downloadable programming source code which you could rename to tkinter_filebrowser_test.py
Link to Python website … Home of Python … where quote up the top resides
Link to Python jobs done … Python jobs done … personal experience
And yes, it’s true … the language name is a fond reference to Monty Python
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.