Home arrow Python arrow Page 3 - A Look at wxPython

Creating Windows and Status Bars - Python

This article is the first in a series covering wxPython, a library that makes it easy for Python programmers to build graphical user interfaces. It introduces some simple dialogs, explains how to create a simple frame, how to create a menu, and how to add two basic controls to a panel.

TABLE OF CONTENTS:
  1. A Look at wxPython
  2. The Basics
  3. Creating Windows and Status Bars
  4. Creating Menus
  5. Events
  6. Some Widgets
By: Peyton McCullough
Rating: starstarstarstarstar / 23
June 22, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

All right. Dialogs are fine to mess with for a while, but let's move on. (By the way, note that wxPython includes many more dialogs). Let's create a window:

from wxPython.wx import *

application = wxPySimpleApp()

dialog = wxFrame ( None, wxID_ANY, 'Title Here.' )

dialog.Show ( True )

application.MainLoop()

When creating a wxFrame, three arguments are passed, as you can see. The first argument is the parent, which you have already seen. Our window does not have a parent. The second argument is the ID of the object. We don't need to worry about it in this tutorial - passing wxID_ANY will work fine. The third argument is, obviously, the title of the window.

Many applications have status bars at the bottom with certain text. We can add a simple one to our application:

from wxPython.wx import *

application = wxPySimpleApp()

window = wxFrame ( None, wxID_ANY, 'Title Here.' )

window.CreateStatusBar()

window.Show ( True )

application.MainLoop()



 
 
>>> More Python Articles          >>> More By Peyton McCullough
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: