Tkinter is a GUI module for python. you can use it to make GUI based applications in python. Tkinter provides several GUI widgets like buttons,menu, canvas,text,frame,label etc. to develop desktop applications.Though Tkinter is very popular and is included with windows, macosx install of python, There are also alternative choices like pyQt, wxPython…
In this tutorial we will see how to install it on linux and use it with an example.
for python 3
How to Use it
Now, lets check if Tkinter is working well with this little example
open your terminal and enter into your python shell.
for python3
if python was installed correctly you will get a >>> prompt.
Now import Tkinter module. it wont show any error if it got imported correctly. NOTE: Make sure you type Tkinter (not tkinter) in python2 and tkinter (not Tkinter) in python3.
Now, just to check you can create an empty window using Tkinter.
In this tutorial we will see how to install it on linux and use it with an example.
Install Tkinter
sudo apt-get install python-tk
sudo apt-get install python3-tk
Now, lets check if Tkinter is working well with this little example
open your terminal and enter into your python shell.
python
python3
raghavareddy@raghavareddy:~$ python raghavareddy@raghavareddy:~$ python Python 2.7.3 (default, Oct 26 2016, 21:01:49) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
>>>import Tkinter >>>
>>>Tkinter.Tk()
No comments:
Post a Comment