我正在用wxpython构建一个GUI,它由类似于彩色热图的按钮/静态文本网格(25 x 25网格)组成
尝试为每个单独的静态文本/按钮设置自定义颜色时遇到错误
我有一个静态文本/按钮的工作数组,无法使用下面的代码为各个静态文本/按钮设置自定义颜色。
sizer = wx.GridSizer(25, 25, 0, 0)
sizer.AddMany([wx.StaticText(panel,size=(30,30), label='A1',style=wx.ALIGN_CENTER).SetBackgroundColour((255,0,0)),
wx.StaticText(panel,size=(30,30), label='A2',style=wx.ALIGN_CENTER).SetBackgroundColour((255,255,0)),
我期望我可以使用SetBackgroundColor()将自定义背景色设置为不同的statictext和button
我遇到以下错误:
TypeError: Sizer.Add(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'bool'
overload 2: argument 1 has unexpected type 'bool'
overload 3: argument 1 has unexpected type 'bool'
overload 4: argument 1 has unexpected type 'bool'
overload 5: not enough arguments
overload 6: not enough arguments
overload 7: argument 1 has unexpected type 'bool'
overload 8: argument 1 has unexpected type 'bool'
overload 9: argument 1 has unexpected type 'bool'