Introduction to Python


How to install Python on Linux
How to run a Python program
The basic of Python codes
Data expressions
Built-in functions in Python
Interactive input/output
Conditional statement for Python
Loop structure for Python
Creating your own functions
Python modules
Reading/writing files for Python
Error handling code
Object Oriented Programming (OOP)
Tkinter package for GNU programming

Tkinter package for GNU programming

There is a package called Tkinter to program GNU. Install it by typing "apt-get install python-tk" Here is a basic example using Tkinter.
from Tkinter import *
class Keys(Frame):
   def __init__(self):
       #When typing 'quit', the program will exit.
       #The pack() determines the place.
   def QuitEvent(self,event):
       import sys
Make an instance and start the event. The mainloop() is a method in Tkinter to keep editing in the window until you close.
myApp = Keys()
The typical widgets of Tkinter are: Frame; Button; Entry; Text; Radiobutton; PhotoImage; Listbox; Scrollbar; Checkbutton, etc.

You have to use <space> is for space-key for Tkinter.

Back to Electronics Page

Back to Hiro's Physics Main