0
我在我的GUI中添加了一个图像到面板中。我希望这个图像适合面板,在那里我想使它的长度与面板的长度一样。我该怎么做?使用wxpython构建GUI
我在我的代码中做了以下操作?所以图像出现在面板顶部,因为我想要的,但我想调整此图像以增加其长度。
class myMenu(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(900, 700))
panel = wx.Panel(self, -1)
panel.SetBackgroundColour('#4f3856')
img = 'C:\Users\DELL\Desktop\Implementation\img1.jpg'
bmp = wx.Bitmap(img)
btmap = wx.StaticBitmap(panel, wx.ID_ANY, bmp, (0, 0))
您创建了一个位置但不是大小的'wx.StaticBitmap'。只需传递你想要的大小。 –