do it yourself listbox control

Thomas Heller theller at python.net
Fri Mar 14 14:36:21 EST 2003


mirandacascade at yahoo.com (Miranda Evans) writes:

> Win2K operating system.
> Python 2.2
> 
> Constraint:not able to use any of the various applications (e.g.
> Tkinter, wxPython, PythonCard) that simplify the process of handling a
> UI.
> 
> Looking for sample code that handles a listbox control.  Hopefully,
> the sample code will illustrate:
> - how to accept a list of information passed to it and display that
> list in something that looks like a listbox control
> - how to detect whether an entry in the list has been selected (where
> selected means the user has clicked on a row in the list)
> - if a list entry has been selected and the user has clicked the OK
> button, how the code that gets excuted when OK button is clicked can
> reference the various columns of information in the selected row of
> the list
> - how to detect whether the cancel button has been clicked
> 
> Although this application cannot make use of the various UI tools (see
> constraint above), this application can import various classes/modules
> that might be regarded as UI-related, e.g.
> 
> import win32ui
> import win32api
> import win32con
> from pywin.mfc import dialog
> 

Isn't MFC a UI tool by your definition?

> I'm guessing that this 'do it yourself' listbox is available
> somewhere, but I'm not sure where to look.

IMO the activestate distribution contains a help search/browse facility
which demonstrates this.

If you really want to do it without a prefabricated UI toolkit, just
using the raw win32 api, welcome to ctypes:
http://starship.python.net/crew/theller/ctypes.html.

Also anygui contains backends using ctypes and win32gui (not win32ui or mfc).

Thomas




More information about the Python-list mailing list