Writing /home/project-web/ophidian/htdocs/data/_cache/instructions/38243f5cce97604ceb2b0f7c42f8e185 failed
Writing /home/project-web/ophidian/htdocs/data/_cache/xhtml/38243f5cce97604ceb2b0f7c42f8e185 failed

What is Ophidian?

Ophidian is a Python module created to easily develop wxPython user interfaces. Ophidian provides wrapper classes to transparently load XRC resources and access the user controls inside them, with a minimum of coding effort.

Get the latest version at http://sourceforge.net/project/showfiles.php?group_id=144224

Send me your questions, suggestions, critics, etc.


Martin Elsner Ramos ophidian@melsner.com.ar

Use Example

The following example shows a little window with a text box where you can write your name. After that, clicking in the Say Hello button will show a greeting message box.

HelloWorld.xrc file

You can generate this file using wxGlade, XRCed or your favorite XRC editor. No need to write it by hand!

<?xml version="1.0" encoding="utf-8"?>
  <object class="wxFrame" name="HelloWorld">
    <title>Ophidian sample</title>
    <object class="wxBoxSizer">
      <object class="sizeritem">
        <object class="wxBoxSizer">
          <object class="sizeritem">
            <object class="wxStaticText">
              <label>Your name:</label>
          <object class="sizeritem">
            <object class="wxTextCtrl" name="nameField"/>
      <object class="sizeritem">
        <object class="wxButton" name="helloButton">
          <label>Say Hello</label>

HelloWorld.py file

See how easy is accessing the nameField text control. It’s already there, just because it was declared in the HelloWorld.xrc file.

import ophidian, wx
class HelloWorld(ophidian.Frame):
    def helloButton_EVT_BUTTON(self, e):
        This method will be automatically called when the user clicks
        on the button whose name in the XRC file is helloButton.
        name = self.nameField.GetValue()
        m = wx.MessageDialog(parent=self.Root, message='Hello, %s!' % name, style=wx.OK|wx.ICON_INFORMATION)
# Main method.    
if __name__ == '__main__':
    w = HelloWorld()
SourceForge.net Logo
ophidian.txt · Last modified: 2005/08/09 16:17
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki