wxwidgets - wxPython wrong file dialog for save file picker? -


consider example (ubuntu 14.04, python 2.7.6, python-wxgtk2.8:amd64/trusty 2.8.12.1):

import wxversion wxversion.select("2.8") import wx, wx.html import sys  class frame(wx.frame):   def __init__(self, *args, **kwds):     kwds["style"] = wx.default_frame_style     wx.frame.__init__(self, *args, **kwds)      self.file_picker_inpdffilepath = wx.filepickerctrl(self, wx.id_any, "", "open pdf file:", "pdf files (*.pdf)|*.pdf", none, none, wx.flp_default_style | wx.flp_use_textctrl)     self.file_picker_outpdffilepath = wx.filepickerctrl(self, wx.id_any, "", "choose output pdf file name:", "pdf files (*.pdf)|*.pdf", none, none, wx.flp_save | wx.flp_use_textctrl | wx.flp_overwrite_prompt)     sizer_vmain_app = wx.boxsizer(wx.vertical)     sizer_vmain_app.add(self.file_picker_inpdffilepath, 1, wx.expand, 0)     sizer_vmain_app.add(self.file_picker_outpdffilepath, 1, wx.expand, 0)     self.setsizer(sizer_vmain_app)     self.layout()  if __name__ == "__main__":   app = wx.pysimpleapp(0)   wx.initallimagehandlers()   app_frame = frame(none, wx.id_any, "")   app.settopwindow(app_frame)   app_frame.show()   app.mainloop() 

here have 2 file pickers, 1 should set file load (wx.flp_load, part of default style), other save (wx.flp_save). when run this, get:

wx-filepick.png

then click "(no..." button, , file open dialog:

load-file-diag.png

... enough. however, when click "browse" button, should raise system dialog saving files - raises exact same 1 load (regardless of if use wx.flp_use_textctrl or not)! have expected, file dialog has text entry widget (so can select, rename on fly), 1 raised firefox's save page as...:

save-as.png

is there way force kind of dialog show, when clicking on "browse" of wx.flp_save wx.filepickerctrl - , if so, how?

i have never used filepickerctrl this. instead have used wx.filedialog. tested code wxpython 3.0.2 classic , works expected, agree bug in old version.

if stuck old version, might find following modified code helpful uses wx.filedialog instead:

import wx, wx.html import sys  class frame(wx.frame):     def __init__(self, *args, **kwds):         kwds["style"] = wx.default_frame_style         wx.frame.__init__(self, *args, **kwds)          self.file_picker_inpdffilepath = wx.filepickerctrl(self, wx.id_any, "", "open pdf file:", "pdf files (*.pdf)|*.pdf", none, none, wx.flp_default_style | wx.flp_use_textctrl)         self.file_picker_outpdffilepath = wx.button(self, label='save')         self.file_picker_outpdffilepath.bind(wx.evt_button, self.onsave)         sizer_vmain_app = wx.boxsizer(wx.vertical)         sizer_vmain_app.add(self.file_picker_inpdffilepath, 1, wx.expand, 0)         sizer_vmain_app.add(self.file_picker_outpdffilepath, 1, wx.expand, 0)         self.setsizer(sizer_vmain_app)         self.layout()       def onsave(self, event):         path = none         dlg = wx.filedialog(self,                       message="choose output pdf file name:",                       defaultdir='',                       wildcard="pdf files (*.pdf)|*.pdf",                       style=wx.fd_save | wx.flp_use_textctrl | wx.flp_overwrite_prompt)         if dlg.showmodal() == wx.id_ok:             path = dlg.getpath()          dlg.destroy()         return path  if __name__ == "__main__":     app = wx.pysimpleapp(0)     wx.initallimagehandlers()     app_frame = frame(none, wx.id_any, "")     app.settopwindow(app_frame)     app_frame.show()     app.mainloop() 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -