How to open an explorer window?

Hi,

First of all I don’t mean to sound unappreciative, I apologize if I have offended. Secondly by “unclean” I mean that you’re passing in an arbitrary string that must be parsed; whereas all of the data components in the string can be split up to represent objects and/or methods. For example, wx.FileDialog is an interface that has members functions that do various tasks. Creating a explorer window using that string is like creating a wx.FileDialog by doing: wx.MakeDlg( “-title ‘Open a file’ -extensions ‘.txt,.cpp’ -button ‘ok’ -button ‘cancel’” ). My basic point is that I was expecting a more object oriented way of opening an explorer window, much like wx.FileDialog in comparison.

wxWidgets is supposed to be platform independent, which makes this task difficult. I’m not an expert in any other operating system but Windows, but the way file explorer is interfaced through windows just seems like a very platform specific thing to me (other operating systems might do it completely differently I imagine). Secondly, your suggestion gets the job done in one line of code, so no point in complaining. It was my fault for not phrasing my previous comment correctly, I meant to say that it’s actually clean in terms of code size, and by “unclean” I meant it’s not object oriented.

I hope I’ve cleared up any miscommunication. Thanks again for the wonderful solutions.

···

On 8/1/07, Grant Edwards < grante@visi.com> wrote:

On 2007-08-01, Robert Dailey < > rcdailey@gmail.com> wrote:

The suggestions here so far I like better than nothing,

I’m curious: what exactly do you think is wrong with it?

subprocess.Popen(‘explorer /select,c:\path\to\file.py’)

It does exactly what you asked with a single line of code, yet
you’re dissatisfied.

at least the code is somewhat clean.

What’s unclean about it?


Grant Edwards grante Yow! I hope I bought the

                              at               right relish ... zzzzzzzzz
                           [visi.com](http://visi.com)            ...

To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org

You asked how to do a platform specific task and received a platform
specific example.

More specifically, you wanted to launch a separate process with
specific arguments. There's absolutely no need for an "object
oriented" solution here and it's totally different than creating a
dialog because you are launching a platform specific utility, not
doing anything internal to your application.

If you're worried about the command line (which is valid, to an
extent) there are more complicated ways to call Popen that less you
pass the command line args separately. I'm sure you can figure those
out if you want them.

···

On 8/1/07, Robert Dailey <rcdailey@gmail.com> wrote:

Hi,

First of all I don't mean to sound unappreciative, I apologize if I have
offended. Secondly by "unclean" I mean that you're passing in an arbitrary
string that must be parsed; whereas all of the data components in the string
can be split up to represent objects and/or methods. For example,
wx.FileDialog is an interface that has members functions that do various
tasks. Creating a explorer window using that string is like creating a
wx.FileDialog by doing: wx.MakeDlg( "-title 'Open a file' -extensions
'*.txt,*.cpp' -button 'ok' -button 'cancel'" ). My basic point is that I was
expecting a more object oriented way of opening an explorer window, much
like wx.FileDialog in comparison.

wxWidgets is supposed to be platform independent, which makes this task
difficult. I'm not an expert in any other operating system but Windows, but
the way file explorer is interfaced through windows just seems like a very
platform specific thing to me (other operating systems might do it
completely differently I imagine). Secondly, your suggestion gets the job
done in one line of code, so no point in complaining. It was my fault for
not phrasing my previous comment correctly, I meant to say that it's
actually clean in terms of code size, and by "unclean" I meant it's not
object oriented.

I hope I've cleared up any miscommunication. Thanks again for the wonderful
solutions.