User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 402,477 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,874 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums

Starting Python

Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,425
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 9
Solved Threads: 173
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Starting Python

  #8  
Mar 27th, 2005
The IDLE integrated development environment that comes with the normal Python installation is really a GUI program. It uses Tkinter as the GUI interface/library, also part of the normal installation. Tkinter uses tcl script language to do the work.

Here is a typical Python code example using Tkinter ...
  1. # import all the Tkinter methods
  2. from Tkinter import *
  3.  
  4. # create a window frame
  5. frame1 = Tk()
  6. # create a label
  7. label1 = Label(frame1, text="Hello, world!")
  8. # pack the label into the window frame
  9. label1.pack()
  10.  
  11. frame1.mainloop() # run the event-loop/program
This code should run on Windows and Unix (PC or Mac). On a Windows machine save the program with a .pyw extension. This way it associates with pythonw.exe and avoids the ugly black DOS display popping up.

If you want to know more about Tkinter, you can run help("Tkinter") from IDLE. This will bring up all of Tkinter's documentations strings. You can also find much Tkinter detail at:
http://infohost.nmt.edu/tcc/help/pub...ter/index.html

There is another GUI library worth mentioning, it's wxPython based on C++. The code is more efficient for GUI stuff. The download of the installer is free, look at http://wiki.wxpython.org/

You can get wxPython for either Windows or Linux. There are some wxPython GUI examples in the DaniWeb Python Code Snippets. Here is a very nice wxPython tutorial I like to recommend, it will give you a good overview (examples work on Windows, Linux, or Unix):
http://wiki.wxpython.org/index.cgi/AnotherTutorial

Note: GUI stands for Graphical User Interface. It's the usual Window matter like frames, buttons, labels, editboxes.
Last edited by vegaseat : May 19th, 2007 at 2:51 pm. Reason: [code=python] tag
May 'the Google' be with you!
Reply With Quote  
All times are GMT -4. The time now is 4:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC