You are not logged in.
Hi,
I am thinking about writing a small little program with a GUI that should work in both linux and windows. For this my plan is to use python and tkinter and I've installed eclipse and pydev. But I've failed to even import tkinter in my program!
I see that tkinter is available in /usr/lib/python3.2/ but do I need to do anything to make it available?
I've never done any GUI-programming before, only some small scripts in various languages so I am a beginner...
Last edited by Tisse (2011-04-20 16:51:12)
Offline
I recommend you to use pyqt. You have good documentation, qt-designer to create your gui and looks nice.
Offline
Ok. Does it work and look good on a windows machine as well?
Is it easy to start using it in arch-linux?
Offline
I'll throw in my opinion as well.
I use, and love wxPython, the Python bindings for wxWidgets. It is similar to PyQt in terms of learning curve. It is fast, it runs well on Linux and Windows.
The problem I've with PyQt is the license. On my own time, I fully embrace the GPL. At work, however, I must consider the ramifications of that license, the requirement to distribute source, and non-disclosure agreements we have in place with our partners. wxPtyhon is LGPL. Even though Qt is LGPL, PyQt is GPL.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
Thanks. The license type doesn't really matter for me, I will create a small program that I will spread as open source if it gets good enough. So I might look at both of them.
Are wxPython and PyQT easily installed on arch-linux and easy to setup using eclipse and pydev?
Offline
I know Qt is well supported by Eclipse, but I have not tried using Eclipse to explore the PyQt library. Python presents some challenges to IDEs because auto completion for a loosely typed, reflective language. I have had some difficulties with C++ and Qt in Eclipse during debugging using Arch's standard Qt installation. Also, there is a program that is part of PyQt that takes the xml files that define a GUI and translate them into Python. I do not know how smoothly that program integrates with the build system.
wxPython is well supported by Eclipse and does a nice job of auto completion. The documentation for PyQt is awful. Fortunately, the documentation for wxWidgets is pretty good and can be used to infer how to use wxPython. There is no problem with the integration of the GUI design tools -- because there aren't any
In general, I find wxPython (and wxWidgets) to be much lighter weight than PyQt and Qt. Also, it is a lot less trouble to install wxWidgets on Windows than Qt. (IIRC, Qt is MinGW based, whereas wxWidgets can be compiled with minGW, Borland, or Visual Studio) Qt installs bring in all of the MinGW cruft, whereas wxWidgets does not.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
I tried to use wxPython but it didn't work for me, the module wasn't found. Could it be because I have several versions of python installed (3.2 and some older versions)?
I tried a "hello world" for PyQT and that worked for me out of the box. But after have read your comment I would like to get wxPython working and use that instead. Is there a guide or something that explains how to get it up and running on arch?
Offline
I tried to use wxPython but it didn't work for me, the module wasn't found. Could it be because I have several versions of python installed (3.2 and some older versions)?
I tried a "hello world" for PyQT and that worked for me out of the box. But after have read your comment I would like to get wxPython working and use that instead. Is there a guide or something that explains how to get it up and running on arch?
wxPython has not yet been ported to Python 3. Of the 4 main GUI toolkits for Python (wxPython, PyQt, PyGtk and Tkinter) only PyQt and Tkinter have been ported.
If you really want to use wxPython, you'll have to write your program in Python 2.
Offline
In general, I find wxPython (and wxWidgets) to be much lighter weight than PyQt and Qt. Also, it is a lot less trouble to install wxWidgets on Windows than Qt. (IIRC, Qt is MinGW based, whereas wxWidgets can be compiled with minGW, Borland, or Visual Studio) Qt installs bring in all of the MinGW cruft, whereas wxWidgets does not.
This thing you say about mingw is not true:
http://doc.qt.nokia.com/vs-add-in-1.1.7/index.html
In fact, I have developed an application with pyqt and never heard of mingw before a few weeks, when I needed to recompile qt with mysql support (the mysql binary does not come with the opensource version of qt... if you need help with this just say it).
Then, using py2exe I can bundle the whole application in a single exe that runs smoothly. The application has more files, but they are external command line tools and configuration files... no qt needed on the target computer.
Last edited by Pajaro (2011-04-17 23:09:43)
Offline
This thing you say about mingw is not true:
http://doc.qt.nokia.com/vs-add-in-1.1.7/index.html
...
Fair enough, I stand corrected (I did say IIRC). I generally avoid the non-express versions of Visual Studio. I also tend to cross compile under Linux rather than use Windows. This may have been the root of my misunderstanding.
Thanks
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
Sorry. I see that I missunderstood, and I know why. What is IIRC?
http://www.acronymfinder.com/IIRC.html
Between the 21 choices I guess you didn't mean 'Iraqi Islamic Reconciliation Conference', so I vote for 'If I Remember Correctly'. Am I right?
Last edited by Pajaro (2011-04-18 05:40:39)
Offline
Between the 21 choices I guess you didn't mean 'Iraqi Islamic Reconciliation Conference', so I vote for 'If I Remember Correctly'. Am I right?
Yes.
IMHO, perhaps I should be more careful with abbreviations -- ROTFLOL,
As to Qt perhaps I should RTFM
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
Hi,
Thanks for all advice. I believe it is best that I start with one and see what I can do with it. As a beginner with a limited amount of free time it will probably take a while before I reach the limitations of each choice.
So I better stop talking about creating a cool python application and start doing :-)
Offline
Tisse,
Going back to Tkinter topic, what did you try that did not work exactly?
Offline
Tisse probably just needs to install the tk package...
Offline
Hi,
I tried a simple "hello world"
from Tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()
But the output were:
Traceback (most recent call last):
File "/home/tisse/workspace/PyTest/src/HelloWorld.py", line 6, in <module>
from Tkinter import *
ImportError: No module named Tkinter
And I do have tk installed:
extra/tk 8.5.9-1 [installed]
A windowing toolkit for use with tcl
Offline
Hi,
I tried a simple "hello world"
from Tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()But the output were:
Traceback (most recent call last):
File "/home/tisse/workspace/PyTest/src/HelloWorld.py", line 6, in <module>
from Tkinter import *
ImportError: No module named TkinterAnd I do have tk installed:
extra/tk 8.5.9-1 [installed]
A windowing toolkit for use with tcl
In Python 3, you import tkinter, not Tkinter (lower case "t").
Offline
Common practice is to go this way:
from tkinter import *
from tkinter import ttk
That way, theme tk widget will be used in favor of regular widgets.
Here is a very good place to get you started http://www.tkdocs.com/tutorial/firstexample.html
Offline
So it was so simple... I must have read an old tutorial.
Thanks for the advice, it works now!
Offline