Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

A much easier way to solve this in Python, and get rid of all the related factory classes, is to use import statements:

In widget.py, you'd have something like this (I'm making it up):


if sys.platform == 'linux'
  from gtk import GtkTextBox as TextBox
elif sys.platform == 'win32'
  from winforms import TextBox as TextBox

Then in your GUI code you would just have this:


from widgets import TextBox
...

def buildForm():
   textbox = TextBox()

Of course, you might need an extra adapter layer to give them the same interface, but it's not hard.

f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.