[Tutor] wxPython

Terje Johan Abrahamsen terjeja@hotmail.com
Wed, 31 Jul 2002 20:29:33 +0000


I downloaded wxPython and started to look around. It seems to be a great 
tool. However, I haven't found much documentation. Ok, there is, but not 
that I understand much of. Most seems to be for C++.

So, I took one of the examples and tried to run it in Python. But, it wanted 
some arguments. However, I have no idea what arguments to give, and all my 
guesses ended in failure. Could somebody look at this code, and let me know 
what arguments are needed? And hopefully also write a few sentences about 
how this thing work. I guess, when I get it first running, I can modify and 
play around... PS!! This is all I can find about it. No more 
documentation...

Thanks in advance,
Terje

from wxPython.wx import *

#---------------------------------------------------------------------------

class TestCheckBox(wxPanel):
    def __init__(self, parent, log):
        self.log = log
        wxPanel.__init__(self, parent, -1)

        wxStaticText(self, -1, "This example uses the wxCheckBox control.",
                               wxPoint(10, 10))

        cID = NewId()
        cb1 = wxCheckBox(self, cID,   "  Apples", wxPoint(65, 40), 
wxSize(150, 20), wxNO_BORDER)
        cb2 = wxCheckBox(self, cID+1, "  Oranges", wxPoint(65, 60), 
wxSize(150, 20), wxNO_BORDER)
        cb2.SetValue(true)
        cb3 = wxCheckBox(self, cID+2, "  Pears", wxPoint(65, 80), 
wxSize(150, 20), wxNO_BORDER)

        EVT_CHECKBOX(self, cID,   self.EvtCheckBox)
        EVT_CHECKBOX(self, cID+1, self.EvtCheckBox)
        EVT_CHECKBOX(self, cID+2, self.EvtCheckBox)


    def EvtCheckBox(self, event):
        self.log.WriteText('EvtCheckBox: %d\n' % event.Checked())

#---------------------------------------------------------------------------

def runTest(frame, nb, log):
    win = TestCheckBox(nb, log)
    return win

#---------------------------------------------------------------------------















overview = """\
A checkbox is a labelled box which is either on (checkmark is visible) or 
off (no checkmark).

"""




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx