【发布时间】:2011-06-02 12:19:58
【问题描述】:
class iFrame(wx.Frame):
def __init__(blah blah blah):
wx.Frame.__init.__(blah blah blah)
self.panel = wx.Panel(self, -1)
self.panel.SetBackgroundColour((I put a random RGB here for test purposes))
c_color = wx.Button(self.panel, -1, 'Press To Change Color')
c_color.Bind(wx.EVT_BUTTON, self.OnCC)
def OnCC(self, evt):
dlg = wx.ColourDialog().SetChooseFull(1)
if dlg.ShowModal() == wx.ID_OK:
data = dlg.GetColourData()
color = data.Colour
print (color) # I did this just to test it was returning a RGB
self.panel.SetBackgroundColour(color)
dlg.Destroy()
我尝试做的是将一个按钮链接到一个颜色对话框,将 RGB 存储在一个变量中并使用它来设置面板的背景颜色...我已经测试了几乎所有这些,我已经插入返回的 RGB 直接进入 self.panel 本身就可以了,为什么我在这个方法中使用它时它不起作用
【问题讨论】:
-
你遇到什么错误???
-
无,只是不改变背景颜色
标签: python wxpython colordialog