Hi I have a button in this panel whose code I have given below. I am running this on Mac OSX.
If I set the border around the button to be 50 pixels , then the button does not respond to clicks even though I can see the entire button
Only if I resize the window can I suddenly click the button
The problem does not happen if the border is only 10 pixels.
I am trying to understand why a fully visible and event bound button does not respond to clicks
thanks for your help
hari
Funky unclickeable button
import wx
class MaFrame(wx.Frame):
def init(self,*args,**kwds):
wx.Frame.init(self,*args, **kwds)
self.SetSize((634,440))
self.Layout()
class PlatePanel(wx.Panel):
def init(self,*args,**kwds):
wx.Panel.init(self,*args,**kwds)
self.platelabel = wx.StaticText(parent=self,id=-1,label=“Plate”)
self.text_ctrl_1 = wx.TextCtrl(self, -1, “A1”,(150,0))
self.text_ctrl_2 = wx.TextCtrl(self,-1,“A12”,(150,0))
self.plate_add_button = wx.Button(self,label=“AddPlate”)
self.do_connections()
self.do_layout()
def do_layout(self):
sizer_top = wx.BoxSizer(wx.VERTICAL)
sizer_widgets = wx.BoxSizer(wx.HORIZONTAL)
sizer_widgets.Add(self.platelabel,0,wx.ALIGN_RIGHT|wx.ALIGN_CENTER|wx.LEFT|wx.RIGHT,50)
sizer_widgets.Add(self.text_ctrl_1,0,wx.ALIGN_CENTER|wx.LEFT|wx.RIGHT,50)
sizer_widgets.Add(self.text_ctrl_2,0,wx.ALIGN_CENTER|wx.LEFT|wx.RIGHT,50)
sizer_top.Add(sizer_widgets,3,wx.EXPAND)
sizer_top.Add(self.plate_add_button,1,wx.ALL|wx.ALIGN_RIGHT,50)
self.SetSizer(sizer_top)
self.Fit()
def do_connections(self):
self.Bind(wx.EVT_BUTTON,self.add_plate_def,self.plate_add_button)
print “Bound”
def add_plate_def(self,event):
print “Clicked Button for plate add”
if name==“main”:
app = wx.PySimpleApp()
maframe = MaFrame(parent=None,title=“Gzilla”,size=(500,440))
plate_panel = PlatePanel(parent=maframe)
maframe.Show()
app.MainLoop()