Strange coloring issue of default buttons in wx.Dialog and wx.Panel
Alexey Borzenkov
snaury at gmail.com
Tue Apr 24 01:22:14 PDT 2007
Hi all,
I've stumbled upon a strange coloring issue with default buttons on
wx.Dialog when I put them inside of wx.Panel and when I have Luna (or
any other non-classic) theme on Windows. Here's the code:
import wx
class MainWindow(wx.Dialog):
def __init__(self):
super(MainWindow, self).__init__(None, -1,
style=wx.SYSTEM_MENU|wx.CAPTION|wx.MINIMIZE_BOX)
panel = wx.Panel(self)
button1 = wx.Button(panel, wx.ID_OK, "OK")
button2 = wx.Button(panel, wx.ID_CANCEL, "Cancel")
sizer = wx.BoxSizer()
sizer.Add(button1)
sizer.Add(button2)
panel.SetSizerAndFit(sizer)
panel.SetAutoLayout(True)
app = wx.App()
window = MainWindow()
try:
window.ShowModal()
finally:
window.Destroy()
If you run it and try pressing Tab to navigate between buttons, you
will see that when you navigate away from the button it's as if it's
not repainted correctly (selection dot box is not painted anymore, but
coloring is still for an active button). Another odd thing is that if
you minimize the window and then restore it, coloring becomes normal,
until you try navigating again. Odd thing is that when buttons are not
on the panel, this is not happening:
import wx
class MainWindow(wx.Dialog):
def __init__(self):
super(MainWindow, self).__init__(None, -1)
button1 = wx.Button(self, wx.ID_OK, "OK")
button2 = wx.Button(self, wx.ID_CANCEL, "Cancel")
sizer = wx.BoxSizer()
sizer.Add(button1)
sizer.Add(button2)
self.SetSizerAndFit(sizer)
self.SetAutoLayout(True)
app = wx.App()
window = MainWindow()
try:
window.ShowModal()
finally:
window.Destroy()
Is this known behavior or is this a bug?
Best regards,
Alexey.
More information about the wxpython-dev
mailing list