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'。只需傳遞你想要的大小。 –