471,348 Members | 1,723 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Invoking dialog box on file selection

Hey Guys.
This is kind of a mixed question involving the os platform, python and wxpython. I hope this is in the right place, if not then a quick link to somewhere suitable would be great.

Ok basicly i have a dialog box that is acting as the GUI for an image program i'm running. The program is a front end support app for raw image files.
Does anyone know how to invoke the dialog box if the user of the os clicks and tries to open a file of a certain file type?
For example what i want is that the user can either start the dialog box first and then open the file using the open command in my dialog box. Or when navigating through windows explorer (or similar) when the selected file is opened the first box to appear is my dialog box.
Cheers.
Ed
(newbie - only been learning this for a month)
Jul 18 '07 #1
5 2701
bartonc
6,596 Expert 4TB
Hey Guys.
This is kind of a mixed question involving the os platform, python and wxpython. I hope this is in the right place, if not then a quick link to somewhere suitable would be great.

Ok basicly i have a dialog box that is acting as the GUI for an image program i'm running. The program is a front end support app for raw image files.
Does anyone know how to invoke the dialog box if the user of the os clicks and tries to open a file of a certain file type?
For example what i want is that the user can either start the dialog box first and then open the file using the open command in my dialog box. Or when navigating through windows explorer (or similar) when the selected file is opened the first box to appear is my dialog box.
Cheers.
Ed
(newbie - only been learning this for a month)
Hi eddiefisher41. You've come to the right place.
For the first part (getting a file name for a File Dialog), I can provide complete code if you need it (it's actually a code template in Boa Constructor).

For the second part, I can tell you that on Windows you really need to crunch all your scripts and dependencies into a .exe and associate the given file type to your Windows program. But, (I need to try this, myself) it may be possible to just associate the file type with your main script that creates the wxPython app and look at the argv (variable length argument list) that Windows sends it.
Jul 18 '07 #2
Hiya.
Cheers. Yeah ive already sorted out the code to open the file once the dialog box is running, just using the openfile dialog box class.
Yeah thought it may need to wait till right at the end before i can accociate it with the .raw file type.
Thanks.
Ed
Jul 18 '07 #3
Hey Guys.
Right i am coming close to the end of my project and am starting to think about how to invoke my dialog box once a .raw file is selected.
What i am trying to do at the moment is create a small test bench that will open the file and present the filepath to my dialog. The test bench then invokes my dialog
What i am missing is how to pass the filepath into the dialog box. I know how to inport variables into modules that are run from another program, (that is basicly what i'm doing) but when i import the dialog it is called straight away. It seems to go stright into the dialog box's main event loop before i get chance to call it.

How do i get my dialog to look at the test bench and read the value of the filepath?
In terms of the finished solution after i have accociated the dialog with the .raw extension how do i go about passing the filepath from the os into the dialog?

Thanks for your help over the last few months. I'm nearing the end of my project now but will most likely be coding python etc when i come back for my main degree placement.
Cheers.
Ed
Aug 8 '07 #4
bartonc
6,596 Expert 4TB
Hey Guys.
Right i am coming close to the end of my project and am starting to think about how to invoke my dialog box once a .raw file is selected.
What i am trying to do at the moment is create a small test bench that will open the file and present the filepath to my dialog. The test bench then invokes my dialog
What i am missing is how to pass the filepath into the dialog box. I know how to inport variables into modules that are run from another program, (that is basicly what i'm doing) but when i import the dialog it is called straight away. It seems to go stright into the dialog box's main event loop before i get chance to call it.

How do i get my dialog to look at the test bench and read the value of the filepath?
In terms of the finished solution after i have accociated the dialog with the .raw extension how do i go about passing the filepath from the os into the dialog?

Thanks for your help over the last few months. I'm nearing the end of my project now but will most likely be coding python etc when i come back for my main degree placement.
Cheers.
Ed
Hi Ed.

All of the file selection mechanisms that I found, including wxFileSelector, wxFileDialog, and wxFilePickerCtrl, take path, filename, extension and wildcard charaters in their creation methods. If you need a link to the documentation, I can provide that.
Aug 8 '07 #5
Cheers.
Got it sorted now.
Vertually finished my 3 month project, just writing the final report now. In terms of my dialog box i just need to sort out user input verification and thats it.
Quite nicely it absolutly nails every test image i pass it with at most 5 pixels error in a 2Mp image, pretty sweet!!!
Thanks for all of your help on this forum over the past 3 months.
I go back to uni for a year coming in september but come back to work with my industrial placement firm next summer to write my thesis and do an 8 month research project. I expect i'll be using these forums again then as i'll be doing a mixture of hardware and software design, hopefully noise reduction or colour management projects.
Having said that there are a few apps that i want to create to help with day to day life on my hope PC that i may do at some point.
Cheers Guys.
Ed
Aug 10 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Fred | last post: by
3 posts views Thread by bbxrider | last post: by
3 posts views Thread by JoNaS | last post: by
1 post views Thread by Michael Yanowitz | last post: by
13 posts views Thread by marathoner | last post: by
1 post views Thread by =?Utf-8?B?VGVlcmF2ZWU=?= | last post: by
8 posts views Thread by Janwillem | last post: by
6 posts views Thread by Iain King | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.