学习wxpython遇到一个奇怪的问题: panel = wx.Panel(self,-1,(100,100)) wx.Button(panel,-1,'')
1个回答
展开全部
我试了一下,貌似如果只有一个组件的话,默认是填满整个窗口,两个就没问题了。
如果真只有一个,可以试试布局
class PosFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, size = (200, 200), pos = (200, 200))
panel1 = wx.Panel(self, -1, pos = (50, 50), size = (50, 50))
panel1.SetBackgroundColour("green")
# panel2 = wx.Panel(self, -1, pos = (100, 100), size = (50, 50))
# panel2.SetBackgroundColour("blue")
btn = wx.Button(panel1, -1, "PK")
如果真只有一个,可以试试布局
class PosFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, size = (200, 200), pos = (200, 200))
panel1 = wx.Panel(self, -1, pos = (50, 50), size = (50, 50))
panel1.SetBackgroundColour("green")
# panel2 = wx.Panel(self, -1, pos = (100, 100), size = (50, 50))
# panel2.SetBackgroundColour("blue")
btn = wx.Button(panel1, -1, "PK")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询