Hello, I've created a simple form with 2 radio boxes, 2 text boxes and a button. When I click the button, I'd like to write each "choice" to a text file. I can't figure out how to "link" the onClick event to the other 4 controls. Any help would be much appreciated! R.D. Harles
import wx, sys class Form1(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) # Create button self.button =wx.Button(self, 50, "GO!", wx.Point(20, 200)) wx.EVT_BUTTON(self, 50, self.OnClick) ## First name # Edit control self.lblname = wx.StaticText(self, -1, "First Name :",wx.Point(20,50)) self.editname = wx.TextCtrl(self, 10, "", wx.Point(90, 50), wx.Size(100,-1)) wx.EVT_TEXT(self, 10, self.EvtText) ## Last Name # Edit control self.lblname = wx.StaticText(self, -1, "Last Name :",wx.Point(20,75)) self.editname = wx.TextCtrl(self, 20, "", wx.Point(90, 75), wx.Size(100,-1)) wx.EVT_TEXT(self, 20, self.EvtText) # Radio Boxes self.radioList = ['Employed', 'Unemployed'] rb = wx.RadioBox(self, 30, "Status:", wx.Point(20, 100), wx.DefaultSize, self.radioList, 2, wx.RA_SPECIFY_COLS) wx.EVT_RADIOBOX(self, 30, self.EvtRadioBox) # Radio Boxes self.radioList = ['Married', 'Single'] rb = wx.RadioBox(self, 40, "Status:", wx.Point(20, 150), wx.DefaultSize, self.radioList, 2, wx.RA_SPECIFY_COLS) wx.EVT_RADIOBOX(self, 40, self.EvtRadioBox) # Text event def EvtText(self, event): print event.GetString() # RadioBox event def EvtRadioBox(self, event): print event.GetId() # Button event def OnClick(self,event): print "Writing job.cfg..." file = open("job.cfg", "w") file.write("") app = wx.PySimpleApp() frame = wx.Frame(None, -1, " Questions") Form1(frame,-1) frame.Show(1) app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list