calling an event from within a program

J

JDevine

Can someone tell me the proper syntax to create an event from within a
program

here is my example code. I have Checkboxes and Radioboxes operating
on the same Text Control. What I want is when the Checkbox is
unchecked for the EVT_RADIOBOX evt to run therefore populating the
text control with the value that was left on it when it was disabled.
So what I really want to do is run a EVT_RADIOBOX from a checkbox.
any suggestions?



def EvtCheckBox3(event):
print ck3.GetValue()

if ck3.GetValue() == True:
t2.Clear()
t2.SetValue("blah blah")
t2.SetEditable(False)
ck1.SetValue(False)
ck2.SetValue(False)
rb.Enable(False)

else:
t2.Clear()
t2.SetValue("blah blah blah")
t2.SetEditable(True)
rb.Enable(True)



ck3 = wx.CheckBox(self, -1, "blah blah blah", (255, 60), (170,
20), wx.NO_BORDER)
self.Bind(wx.EVT_CHECKBOX, EvtCheckBox3, ck3)

#Create a radio box
def EvtRadioBox(event):
print event.GetInt()
if event.GetInt() == 0:
t2.Clear()
t2.SetValue("Blah Blah Blah")
t2.SetEditable(True)

elif event.GetInt() == 1:
t2.Clear()
t2.SetValue("blah blah blah")
t2.SetEditable(False)

elif event.GetInt() == 2:
t2.Clear()
t2.SetValue("blah blah blah")
t2.SetEditable(False)

.............and elif for each position in the radiobox and finally
creating the radiobox and the binding

sitelist = ['blah', 'ying', 'yang']

sizer = wx.BoxSizer(wx.HORIZONTAL)

rb = wx.RadioBox(
self, -1, "My Radiobox", (10, 215), (425, 70),
sitelist, 5, wx.RA_SPECIFY_COLS
)

self.Bind(wx.EVT_RADIOBOX, EvtRadioBox, rb)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,146
Messages
2,570,831
Members
47,374
Latest member
anuragag27

Latest Threads

Top