python - How to disable/remove the input box in wx.lib.filebrowsebutton.FileBrowseButton? -
looks there's no built-in option disable/remove inputbox/textctrl
part in wx.lib.filebrowsebutton.filebrowsebutton
, did come workaround set labeltext
blank , size down fit button itself, way visually can tell no difference normal button, don't think it's nice enough go with.
so there way disable/remove inputbox
part? or maybe way bind normal button file browser function?
if don't need textctrl
, don't need wx.lib.filebrowsebutton
. can have normal wx.button
launches wx.filedialog
instance. in fact, that's wx.lib.filebrowsbbutton
does. here's relevant source code, whole thing can viewed here: https://github.com/wxwidgets/wxpython/blob/master/wx/lib/filebrowsebutton.py
def onbrowse (self, event = none): """ going browse file... """ current = self.getvalue() directory = os.path.split(current) if os.path.isdir( current): directory = current current = '' elif directory , os.path.isdir( directory[0] ): current = directory[1] directory = directory [0] else: directory = self.startdirectory current = '' dlg = wx.filedialog(self, self.dialogtitle, directory, current, self.filemask, self.filemode) if dlg.showmodal() == wx.id_ok: self.setvalue(dlg.getpath()) dlg.destroy()
Comments
Post a Comment