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插入到自面板它本身和它是有效的,那么为什么我在这个方法中使用它时它不起作用呢
行}上的方法吗?在
dlg = wx.ColourDialog().SetChooseFull(1)
似乎是一个bug,SetChooseFull
不是{我做了一些更改以使其正常工作,并对代码进行了注释以说明:
data.SetCustomColor(index, color)
填充对话框中的N
自定义颜色。我在下面的索引0
处圈出了一个:相关问题 更多 >
编程相关推荐