Venster abstracts some of the more anoying details of the win32 API.:

  1. Win32 Windows (identified by their HWND handle) are mapped to real python instances of a python Window class. This is mostly implemented by using a global python dict which maps between the HWNDS and the python Window instances.

    Window messages are connected to python methods trough the use of MSG_MAPS (just as with ATL/WTL/MFC).

    Msg cracking/routing is handled trough a MSG_MAP class, different type of 'handlers' are defined for processing the various msgs types (WM_*, Command messages and Notication messages).

  2. Garbage collection. Most windows objects (windows, menus, etc etc) have some CreateXXX method and some special DestroyXXX method. These are called automatically by the framework when the python 'peer' instances of the windows object becomes garbage. All python windows classes implement a __dispose__(self) method which calls the apropriate windows DestroyXXX function to release the handle.

  3. Automatic Layout management (not implemented yet). This is really lacking in the Windows API. It would be nice to have something like this. (see Swing for Java, it really works there).

Bases on the above a small library of more 'high level' controls is being developed. These controls go beyond what the standard windows controls provide. in order to make them a little bit more 'pythonic'

Source layout

The top level package 'venster' contains the low level windows abstractions:

  • Contains windows constants and functions from user32.dll, the main windows gui library
  • Contains the main Venster abstraction of a 'Window', maps between python Windows and Win32 HANDLE's. This module also implements Message cracking/routing, defines handlers for normal WM_* msgs, WM_NOTIFY notification messages and WM_COMMAND msgs.
  • wtl.pyExtends the Venster abstraction of a 'Window', introduces a lot of convenient methods that are often used to manipulate windows. Also contains basic Windows objects like 'Menu', 'Icon'
  • gdi.pyConstants and structures from the windows GDI. introduces some wrappers for things like Bitmaps and Fonts.
  • Common Controls base library, based on Window abstraction. Wraps the standard windows Common Controls (TreeView, ListView etc)
  • The 'venster.lib' package contains the more high level stuff:

  • A form style main window. Automatically keeps track of other frame windows, closes the app when last form is closed
  • A 'Notebook' control. This is based on the TabControl common control. I contains some hacks to reduce the TabControl's flicker. It automatically hides and unhides the tab panes
  • Extended from TreeView common control. Contains some extra methods to make it more pythonic
  • Extended from ListView common control. Contains some extra methods to make it more pythonic
  • A usefull window splitter class (Windows does not have this, so every toolkit needs its own)
  • Resources


    Some preliminary generated python documentation can be found here...