I got this problem when using platebuttons.
I have a panel with a sizer and the sizer got the platebutton. But when I
click left mouse button on the panel (not on the button) the button gets
highlighted! Is this bug in the platebuttons or bug in my code?
so in the example there's two panels with buttons, when app starts for some
reason first button is highlighted already, but hover the mouse above it
first, then press on the lower panel, and then upper panel, then lower...
and you will see that pressing only the panel highlight the button
as a bonus bug the example code crash when you close it, have no idea why,
but that's not happening in my main program, so don't wonder too much about
that
see the code in http://pastebin.com/f7bed6246
or below:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import wx
import wx.lib.platebtn as platebtn
class MyFrame(wx.Frame):
聽聽聽def __init__(self):
聽聽聽聽聽聽wx.Frame.__init__(self, None, id=-1, title="test", size=(320,100))
聽聽聽聽聽聽main_panel = wx.Panel(self, -1)
聽聽聽聽聽聽#button 1 & panel & sizer
聽聽聽聽聽聽panel2 = wx.Panel(main_panel, -1)
聽聽聽聽聽聽panel2.SetBackgroundColour("#FFFF00")
聽聽聽聽聽聽button = platebtn.PlateButton(panel2, id_=wx.ID_ANY, label="Button 1",
style=platebtn.PB_STYLE_SQUARE)
聽聽聽聽聽聽button_sizer = wx.BoxSizer(wx.VERTICAL)
聽聽聽聽聽聽button_sizer.Add(button, 0, wx.RIGHT|wx.ALIGN_RIGHT, 10)
聽聽聽聽聽聽panel2.SetSizer(button_sizer)
聽聽聽聽聽聽panel2.SetAutoLayout(True)
聽聽聽聽聽聽#button 2 & panel & sizer
聽聽聽聽聽聽panel3 = wx.Panel(main_panel, -1)
聽聽聽聽聽聽panel3.SetBackgroundColour("#FFFFFF")
聽聽聽聽聽聽button2 = platebtn.PlateButton(panel3, id_=wx.ID_ANY, label="Button
2", style=platebtn.PB_STYLE_SQUARE)
聽聽聽聽聽聽button_sizer2 = wx.BoxSizer(wx.VERTICAL)
聽聽聽聽聽聽button_sizer2.Add(button2, 0, wx.RIGHT|wx.ALIGN_RIGHT, 10)
聽聽聽聽聽聽panel3.SetSizer(button_sizer)
聽聽聽聽聽聽panel3.SetAutoLayout(True)
聽聽聽聽聽聽sizer = wx.BoxSizer(wx.VERTICAL)
聽聽聽聽聽聽sizer.Add(panel2, 0, wx.EXPAND)
聽聽聽聽聽聽sizer.Add(panel3, 0, wx.EXPAND)
聽聽聽聽聽聽main_panel.SetAutoLayout(True)
聽聽聽聽聽聽main_panel.SetSizer(sizer)
聽聽聽聽聽聽main_panel.Layout()
app = wx.PySimpleApp()
MyFrame().Show()
app.MainLoop()
路路路
--
View this message in context: http://www.nabble.com/Problem-with-Platebuttons-tp20832417p20832417.html
Sent from the wxPython-users mailing list archive at Nabble.com.