Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help on TkInter 3

Status
Not open for further replies.

sunrisekiran

Programmer
Jan 9, 2005
2
US
hi

I am novice to TkInter. Can anyone please tell me i could i start with TkInter GUI. Means how to start putting an simple application like "hello world". I have gone through some information from python.org. But i want to know which editor should i use (do python itself have TKinter GUI)or should i download Tcl/TK Toolkit,if it is in python itself, then how should i start creating an simple application.

i appreciate if some replies.

bye take care.

sunrisekiran.
 
Hello,

Tkinter module is integrated in python, and is very easy to use, you can download different tutorials, just look for them in the google writting "an introduction to Tkinter".

If you want to make a simple application, I give you a little example:

from Tkinter import*
win=Tk()
Label (win, text='Hello world').pack()
win.mainloop()

an small window will appear with the hello world mesagge.

another example:

from Tkinter import*
win=Tk()
Label (win, text='hello world', fg='red',font=('symbol',10)).pack()
win.mainloop()

as you can see fg=foreground and "font" defines the stile of your text.

That's only the beginning, there are many widgets you can use like Button, Canvas, Entry, Text, Radiobutton, Checkbutton, Toplevel, Menu and so on.

If you have any problem, make me know it, i have developed a lot of tools using Tkinter as platform to create the windows interface.

bye

btcpar
 
It's also important to note that Python is only a wrapper around the Tk function library. If you're looking for tutorials, look in pure Tk archives, then convert the examples to Python.

That being said, if you're interested in creating GUIs in Python then you should really look at WxPython. It's far more powerful than Tk, more intuitive, more flexible and, as a bonus, is cross-platform. The only difference is that it's a tiny bit more complicated to install (because of dependencies) than TkInter, but if you can use the pre-built packages for your platform it's pretty simple.
 
I agree with ericbrunsen, wxPython is far better than Tkinter. With Tkinter you have to force the elements into place.

wxPython has been made really easy - use boa-constructor. Currently version 0.3, you will need wxPython 2.4, not 2.5 or it won't work. Both can be downloaded from sourceforge. boa is an IDE, it has some flaws, but nothing major.

Tutorials and information on wxPython can be found at the wiki site (wiki.wxpython.org), these are fairly good, but you have to understand OOP to get a good grasp of what is going on.

I hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top