473,606 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write a GUI for a python script?

I am a newbie with Python. It's a great language, but I would like to be
able to present a simple gui menu for some of my scripts; something better
than using 'raw_input' prompts.

Any recommendations for a program that will allow me to create the gui
screens? Something useable in Linux.

thanks.

Mar 2 '06 #1
22 5040
Tkinter is the GUI toolkit that comes with Python and is available on
all platform without any
installation effort. It is quite OK for simple things and I would
recommend it for any beginner.
Google for "An Introduction to Tkinter" by F. Lund.

Michele Simionato

Mar 2 '06 #2
wxPython is another good option, especially since there is
boa-constructor, which is a great GUI builder, almost makes it too easy
to make a nice looking app in no time at all.

http://www.wxpython.org/download.php

http://boa-constructor.sourceforge.net/

if you decide to give wxPython a go, make sure to download the demo, it
has tons of usefull code samples.

Mar 2 '06 #3
ianaré wrote:
wxPython is another good option, especially since there is
boa-constructor, which is a great GUI builder, almost makes it too easy
to make a nice looking app in no time at all.

http://www.wxpython.org/download.php

http://boa-constructor.sourceforge.net/

if you decide to give wxPython a go, make sure to download the demo, it
has tons of usefull code samples.


What is the minimal memory footprint of a Hello World wxPython app
meanwhile (when you cx_freeze/py2exe it) ?

Can you debug & call functions interactively from e.g. Pythonwin while a
wxPython app is running.

( When I made a test with wxPython some years ago, it had no option to
step/share its Messageloop. Interaction was "crust"y and I didn't manage
to get smooth debugging (on Windows). )

Robert
Mar 2 '06 #4
Glurt Wuntal wrote:
I am a newbie with Python. It's a great language, but I would like to be
able to present a simple gui menu for some of my scripts; something better
than using 'raw_input' prompts.

Any recommendations for a program that will allow me to create the gui
screens? Something useable in Linux.

thanks.


There are Python bindings to most GUI toolkits (GTK+, Qt, fltk, wxWindows,
and Tk come to mind). You could use any of them. They're all usable in
GNU/Linux.

-- Tk is a mature, small, and simple toolkit. The Python binding
to Tk is called Tkinter.

-- GTK+ is what most Gnome apps use. The Python binding is PyGTK.
http://www.pygtk.org/

-- Qt is what most KDE apps use. The Python binding is called PyQt.

-- wxWindows is a lot like MS Windows MFC if I recall correctly.
The Python binding to wxWindows is called wxPython.
http://www.wxpython.org/

-- For a terminal-based text-mode character-cell display program, you
could use ncurses. http://www.amk.ca/python/howto/curses/
http://gnosis.cx/publish/programming..._python_6.html
---John
--
(remove zeez if demunging email address)
Mar 2 '06 #5
John M. Gabriele wrote:

There are Python bindings to most GUI toolkits (GTK+, Qt, fltk, wxWindows,
and Tk come to mind).


Whoops. Forgot fltk with the pyFLTK Python binding. fltk
is a fast, light, toolkit that's written in C++ but (again,
IIRC) feels more like C-with-classes (which isn't a bad thing).

---John
--
(remove zeez if demunging email address)
Mar 2 '06 #6
On Thu, 02 Mar 2006 19:52:34 +0100
robert <no*****@no-spam-no-spam.com> wrote:
Can you debug & call functions interactively from e.g. Pythonwin while a
wxPython app is running.


It's a snap to incorporate a nice GUI Python shell with object browser
into any wxPython app - wxPython provides its PyCrust shell as a
package, which provides your choice of a widget you can embed or a
top-level window you can create. In one app I worked on I created a
menu item that launched such a shell window, so I could poke around
inside the app.

As far as actual debugging/stepping... I'm not sure. I haven' thad much
luck with Python debugging using anything but Wing IDE.

- Michael

--
mouse, n: a device for pointing at the xterm in which you want to type.
-- Fortune
Mar 2 '06 #7
On 3/2/06, robert <no*****@no-spam-no-spam.com> wrote:
ianaré wrote:
wxPython is another good option, especially since there is
boa-constructor, which is a great GUI builder, almost makes it too easy
to make a nice looking app in no time at all.

http://www.wxpython.org/download.php

http://boa-constructor.sourceforge.net/

if you decide to give wxPython a go, make sure to download the demo, it
has tons of usefull code samples.
What is the minimal memory footprint of a Hello World wxPython app
meanwhile (when you cx_freeze/py2exe it) ?


I'm assuming you mean disk space and not memory usage. A stock
wxPython (from a standard release) wil vary from platform to platform
but is generally about 2.5 megs. This can be brought down rather a lot
if you're willing to spend a fair amount of time learning the
wxWidgets and wxPython build systems and making custom builds but it's
not generally worth the time to me (and I know the build system and
could make customized builds if I wanted to)

I have a non-trivial wxPython application and, using py2exe in "single
executable" mode (thus all the dlls and the zipfile with the .pyc
files are included in the exe) it's just over 5 megs in size.
Can you debug & call functions interactively from e.g. Pythonwin while a
wxPython app is running.

I've never tried it with PythonWin and I don't know how PythonWin
hooks into Python to manage debugging). Both pdb and the debugger in
PyDev work fine for me, however. As another responder said it's
trivial (literally < 5 lines) to add an interactive Python shell to a
wxPython application, which is invaluable for debugging and testing.
( When I made a test with wxPython some years ago, it had no option to
step/share its Messageloop. Interaction was "crust"y and I didn't manage
to get smooth debugging (on Windows). )

I don't believe that wxPython exposes the low level C++ APIs that're
available to hook the wx message loop (it's an efficency issue, from
what I understand), but there are a number of other methods for
integration. The need to hook the message loop is far far less common
than the number of people who ask for it, so you'll forgive me if I'm
skeptical unless someone actually says why they want to.
Robert
--
http://mail.python.org/mailman/listinfo/python-list

Mar 2 '06 #8
> What is the minimal memory footprint of a Hello World wxPython app
meanwhile (when you cx_freeze/py2exe it)


it's kinda weird actually... I'm not 100% sure, but i think it relates
more to py2exe options, not neccessarily to wxPython. in any case the
least memory usage i've seen for an app that has at least some degree
of functionality is around 12k running on win2000. But a much more
complicated and larger app uses about 16k, while another small app uses
like 20k...
???

Mar 2 '06 #9
John M. Gabriele wrote:
-- GTK+ is what most Gnome apps use. The Python binding is PyGTK.
http://www.pygtk.org/ [snip] -- wxWindows is a lot like MS Windows MFC if I recall correctly.
The Python binding to wxWindows is called wxPython.
http://www.wxpython.org/


Note that wxWindows wraps native widgets, so a wxPython application
will use the native Windows widgets on windows, gtk widgets on
Linux/GNOME, Mac widgets on the Mac, etc.

I usually use wxPython for application development, but for my window
manager I'm using pygtk since it needs to be somewhat lower level and
portability to other platforms isn't a concern (turns out even that
isn't quite low-level enough for some things, so I drop down to
accessing the X event queue directly from C in a couple of cases).

Mar 2 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5705
by: Werner Merkl | last post by:
Hi, Python is really great, for small to big programs. For my colleagues and some circumstances I sometimes need to "compile" a script using py2exe. Cause I use Windows, I like to use the (Windows) ability, to add some version infos, comments, etc to the exe file. If I use explorer to check, these properties are visible and correct.
3
1667
by: Ali | last post by:
I have the following webpage with a javasctript in it: <html> <head> <title>Custom Objects Test</title> <script language="javascript"> function PrintCard() { line1 = "<hr>\n"; line2 = "<b>Name: </b>" + this.name + "<br>\n"; line3 = "<b>Email: </b>" + this.email + "<br>\n";
7
1863
by: ckb2102 | last post by:
Hi there, I am new to this so I apologize in advance if I am not following the right etiquette or something... I am working on a project for school. My partner has written a short program in Python which takes 2 arguments - the name of a .mov file and a number which represents the number of seconds into that movie. The program then passes this info to MPlayer and produces as output a .jpg image which is basically the frame of the...
9
2070
by: TPJ | last post by:
First I have to admit that my English isn't good enough. I'm still studying and sometimes I just can't express what I want to express. A few weeks ago I've written 'Python Builder' - a bash script that allows anyone to download, compile (with flags given by user) and install Python and some external modules (e.g. wxPython, PyGTK, Numeric...). I use Python every day and when new version of Python (or some external module) is released, I...
8
9139
by: Alejandro | last post by:
Hi: I'm using pySerial to talk to a RS232 to RS485 converter. In order to control the converter, I need to control the DTR line to enable/disable de RS485 driver. In particular, I need to : write a character to the serial port set the DTR line to level 1 _after_ the last bit of the character is send
6
9914
by: tatamata | last post by:
Hello. How can I run some Python script within C# program? Thanks, Zlatko
3
1917
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't as fun as coding it... And yes alarm bells went off when I found myself typing eval(), and I'm sure this is an 'unusual' use of for: else: . And I know it's not very robust. As an ex cuse/planation, this is what happens when you get an idea in...
2
2243
by: sophie_newbie | last post by:
Hi, I'm wondering if there is a way to get a python script to write text to an input box in a window of another program that is running? For example a text box in a web browser window? Thanks!
8
2885
by: dmoore | last post by:
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2 etc. the child process is interactive: it asks for input then spits out some output, asks for more input then spits out some output. for example, consider the trivial child program:
0
1160
by: atulsharma84 | last post by:
i want to write a python script for a device NGX-5500 whose vendor is telllabs i hv to write python file like some other device file i m giving u example here below import java.lang as lang import java.util as util import com.visionael.DataCollection.TL1Dim as TL1Dim import com.visionael.DataCollection.util.VProperties as VProperties import com.visionael.DataCollection.util.VListMap as VListMap from BaseFamily import *
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6753
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2442
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.