GUI IN PYTHON

[Pages:26]GUI IN PYTHON

By : Sangeeta M Chauhan , Gwalior

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

Best Python GUI Frameworks which supports multiple platforms (Windows, Linux and Mac). These all GUI frameworks are easy to use and popular, some of them are open-source.

? Kivy :OpenGL ES 2, supports multiple platforms namely Windows, MacOSX, Linux, Android iOS and Raspberry Pi. Open source

? PyQT : Cross-platform ,Supports Unix/Linux, Windows, Mac OS X and Sharp Zaurus. It is available in both, commercial as well as GPL license. Although some features may not be available in the free version, but you can use it under the free license with open source.

? WxPython open source wrapper for cross-platform GUI library WxWidgets (earlier known as WxWindows) and implemented as a Python extension module. With WxPython you as a developer can create native applications for Windows, Mac OS and Unix. If you're just beginning to develop applications in WxPython, here is a good simple tutorial you can go through.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

? PyGUI cross-platform framework for Unix, Macintosh and Windows. lightweight,.

? PySide free and cross-platform GUI toolkit Qt initiated and sponsored by Nokia, ,currently supports Linux/X11, Mac OS X, Maemo and Windows and, support for Android is in the plans for the near future. PySide provides tools to works with multimedia, XML documents, network, databases and GUI. A key feature of PySide is its API compatibility with PyQt4, so if you wish to migrate to PySide then the process will be hasslefree.

? Tkinter bundled with Python, Python's standard GUI framework. Popular for its simplicity and GUI. Open source and available under the Python License.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

To create a tkinter application:

1. Import module ? tkinter 2. Create the main window (container) 3. Add any number of widgets to the main

window 4. Apply the event Trigger on the widgets.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

There are two main methods to be used while creating application using tkinter

?Tk (screenName=None, baseName=None, className='Tk', useTk=1): This creates a toplevel widget of Tk which usually is the main window of an application. Each instance has its own associated Tcl interpreter.

? Mainloop() : used when you are ready for the application to run. mainloop() is an infinite loop used to run the application, wait for an event to occur and process the event till the window is not closed.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

To create window

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

Tkinter Widgets (Controls )

Sr.No.

Operator & Description

1

Button

The Button widget is used to display buttons in your application.

2

Canvas

The Canvas widget is used to draw shapes, such as lines, ovals, polygons and rectangles,

in your application.

3

Checkbutton

The Checkbutton widget is used to display a number of options as checkboxes. The user

can select multiple options at a time.

4

Entry

The Entry widget is used to display a single-line text field for accepting values from a

user.

5

Frame

The Frame widget is used as a container widget to organize other widgets.

6

Label

The Label widget is used to provide a single-line caption for other widgets. It can also

contain images.

7

Listbox

The Listbox widget is used to provide a list of options to a user.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

Sr.No.

Operator & Description

8

Menubutton The Menubutton widget is used to display menus in your application.

9

Menu The Menu widget is used to provide various commands to a user. These commands

are contained inside Menubutton.

10

Message The Message widget is used to display multiline text fields for accepting values

from a user.

11

Radiobutton The Radiobutton widget is used to display a number of options as radio

buttons. The user can select only one option at a time.

12

Scale The Scale widget is used to provide a slider widget.

13

Scrollbar The Scrollbar widget is used to add scrolling capability to various widgets, such

as list boxes.

14

Text The Text widget is used to display text in multiple lines.

15

Toplevel The Toplevel widget is used to provide a separate window container.

16

Spinbox The Spinbox widget is a variant of the standard Tkinter Entry widget, which can

be used to select from a fixed number of values.

17

PanedWindow A PanedWindow is a container widget that may contain any number of

panes, arranged horizontally or vertically.

18

LabelFrame A labelframe is a simple container widget. Its primary purpose is to act as a

spacer or container for complex window layouts.

19

tkMessageBox This module is used to display message boxes in your applications.

pythonclassroomdiary. ? Sangeeta M Chauhan, Gwalior

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download