0
我是wxpython
的新手。我正在嘗試編寫一個允許我選擇文件的小應用程序。 我想知道如何改變文件路徑框的寬度。更改FilePickerCtrl框寬度(wxPython)
我的代碼如下:
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title = title, size=(500, 400))
self.Center()
self.panel = wx.Panel(self)
self.label1 = wx.StaticText(self.panel)
self.fileCtrl = wx.FilePickerCtrl(self.panel, size=(100, 50))
row1 = wx.StaticBoxSizer(wx.StaticBox(self.panel, 1, 'Please select the input file:'), orient=wx.HORIZONTAL)
row1.Add(self.label1,0,wx.TOP | wx.RIGHT,70)
row1.Add(self.fileCtrl)
wrapper = wx.FlexGridSizer(1,1,20,20)
wrapper.AddGrowableCol(0)
wrapper.Add(row1,50,wx.TOP | wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER,20)
self.panel.SetSizerAndFit(wrapper)
self.Centre()
#self.Fit()
self.Show()
app = wx.App(False)
win = MainWindow(None, "File selector")
app.MainLoop()