This is how the output of my GUI looks if I run the program right now I made a gui for my program using xrc and I don't know where the filepath string is stored on a wxFilePickerCtrl class button
examples and tutorials online show commands like using GetPath() of course changing the variables for something that would suit but in the filepicker1 in the frame seems to not have that attribute, I can use the button to choose files okay and the normal button to execute also works, been testing it with simple print commands. Thanks for any help
the first line is so it can run without using python command
default imports
import os
import sys
this import line is needed for wxdiag and src
import wx
from wx import xrc
class MyApp(wx.App):
def init_frame(self):
self.res = xrc.XmlResource("test.xrc")
self.frame = self.res.LoadFrame(None, "framemain")
self.panel = xrc.XRCCTRL(self.frame, "panel1")
self.text1 = xrc.XRCCTRL(self.panel, "text1")
self.filepicker1 = xrc.XRCCTRL(self.panel, "filepicker1")
self.button1= xrc.XRCCTRL(self.panel, "button1")
def OnInit(self):
self.init_frame()
self.Bind(wx.EVT_BUTTON, self.OnButton_gobutton, id=xrc.XRCID('button1'))
#--------ListCtrl colums
#--------call populate functions
#--------this gets the main frame to show
self.frame.Show()
return True
def OnButton_gobutton(self, evt):
print "hello"
this loads the main frame and each subsequent element, the none on the first line is because the first frame has the parent
if __name__=="__main__":
app= MyApp(False)
app.MainLoop()
right now on this line
defOnButton_gobutton(self,evt):
line I set up a print command to confirm the button is working, but on this action I want to get the filepath string from a wxFilePickerCtrl class button I set up on xrc. The goal is to choose a file and when I click on the GUI button I should do something else with the chosen file, but I cannot find where #the string for the chosen file is stored.
The wxFilePickerCtrl
class (not the button) has a method GetPath()
that returns a string. I may be missing something, but I think that is what you are looking for. Call self.filepicker1.GetPath()
.