[Boa Constr] wxSpinButton Bug
Status: Beta
Brought to you by:
riaan
From: Lynndon H. <lyn...@ec...> - 2001-08-03 11:43:01
|
Hi there I think I found a bug in the wxSpinButton control. I was attempting to emulate the wxSpinButton in Boa just as a learning exercise. The following is my wxFrame1 code: #Boa:Frame:wxFrame1 from wxPython.wx import * def create(parent): return wxFrame1(parent) [wxID_WXFRAME1, wxID_WXFRAME1PANEL1, wxID_WXFRAME1SPINBUTTON1, wxID_WXFRAME1TEXTCTRL1] = map(lambda _init_ctrls: wxNewId(), range(4)) class wxFrame1(wxFrame): def _init_utils(self): pass def _init_ctrls(self, prnt): wxFrame.__init__(self, id = wxID_WXFRAME1, name = '', parent = prnt, pos = wxPoint(196, 141), size = wxSize(326, 222), style = wxDEFAULT_FRAME_STYLE, title = 'wxFrame1') self._init_utils() self.panel1 = wxPanel(id = wxID_WXFRAME1PANEL1, name = 'panel1', parent = self, pos = wxPoint(0, 0), size = wxSize(318, 192), style = wxTAB_TRAVERSAL) self.textCtrl1 = wxTextCtrl(id = wxID_WXFRAME1TEXTCTRL1, name = 'textCtrl1', parent = self.panel1, pos = wxPoint(120, 72), size = wxSize(100, 21), style = 0, value = '12') v = int(self.textCtrl1.GetValue()) self.spinButton1 = wxSpinButton(id = wxID_WXFRAME1SPINBUTTON1, name = 'spinButton1', parent = self.panel1, pos = wxPoint(224, 72), size = wxSize(16, 24), style = wxSP_ARROW_KEYS | wxWANTS_CHARS | wxSP_VERTICAL) self.spinButton1.SetValue(v) EVT_SPIN(self.spinButton1, wxID_WXFRAME1SPINBUTTON1, self.OnSpinbutton1Spin) def __init__(self, parent): self._init_ctrls(parent) def OnSpinbutton1Spin(self, event): self.textCtrl1.SetValue(str(event.GetPosition())) # self.spinButton1.SetRange(1, 24) #-----------------------------------------end of code Firstly, I could not find the SetRange on either the Constructor or the Properties tab of the Inspector. Not withstanding this, I attempted to insert the last line of this code (using the wxPython demo code just after the "self.spinButton1.SetValue(v) line" (I previously just had a number rather then the "v" as shown above. It ran all right but the Frame Designer insisted that this property needed 3 parameter. A check in the wx docs states only 2. The next thing was that Boa does not like the code "v = int(self.textCtrl1.GetValue())" and I get a error message NameError: Name 'v' is not defined. I know we are not supposed to put manual code into the def statements but I could not work how else to do it. The next thing is that I attempted to use the Boa "Bug Reporting" option on the web pages, but SF did not seem to respond at all. Cheers, beers and more beers Lynndon Harnell Lynndon Harnell |