Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
Iain 6 3672
Iain King wrote:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
Iain
If the only things on your modal dialog are Browse and cancel, just call the
wx.FileDialog directly and eliminate the intermediate modal dialog. If not
don't bind the FileDialog to a button, just create an instance of it as the last
you do in the __init__ method of the modal dialog code.
If this doesn't help, you will have better luck posting to wxpython newsgroup.
-Larry
On May 13, 2:20 pm, Larry Bates <larry.ba...@websafe.com`wrote:
Iain King wrote:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
Iain
If the only things on your modal dialog are Browse and cancel, just call the
wx.FileDialog directly and eliminate the intermediate modal dialog. If not
don't bind the FileDialog to a button, just create an instance of it as the last
you do in the __init__ method of the modal dialog code.
If this doesn't help, you will have better luck posting to wxpython newsgroup.
-Larry
The dialog doesn't only let you call the file dialog, it does other
stuff too. Your suggestion of __init__ sounded promising, but neither
giving the dialog an __init__() method nor an OnInit() method worked.
Thanks anyway.
Iain
On May 13, 2:43 pm, Iain King <iaink...@gmail.comwrote:
On May 13, 2:20 pm, Larry Bates <larry.ba...@websafe.com`wrote:
Iain King wrote:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
Iain
If the only things on your modal dialog are Browse and cancel, just call the
wx.FileDialog directly and eliminate the intermediate modal dialog. If not
don't bind the FileDialog to a button, just create an instance of it as the last
you do in the __init__ method of the modal dialog code.
If this doesn't help, you will have better luck posting to wxpython newsgroup.
-Larry
The dialog doesn't only let you call the file dialog, it does other
stuff too. Your suggestion of __init__ sounded promising, but neither
giving the dialog an __init__() method nor an OnInit() method worked.
Thanks anyway.
Iain
After having a hunt through the wxpython mailing list archives I found
the answer: the event is EVT_INIT_DIALOG:
dlg.Bind(wx.EVT_INIT_DIALOG, onInit, dlg)
work. Thanks for the pointer.
Iain
En Tue, 13 May 2008 09:41:25 -0300, Iain King <ia******@gmail.com>
escribió:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
I've seen you already answered your question. But are you sure that doing
this is a good thing? If you try to be too clever or too helpful the
interfase may become annoying at some times. You can't guess the user's
intention or read his mind.
By example, what if I already have the desired file name copied in the
clipboard? I don't want the file selector to pop up.
I completely *hate* Windows programs with a "Browse for folder" button
that don't let me paste a name, neither start opened at the currently
selected folder.
--
Gabriel Genellina
In article
<a1**********************************@m44g2000hsc. googlegroups.com>,
Iain King <ia******@gmail.comwrote:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
It's too bad that you found an answer. You _shouldn't_ have your
dialog pop up a file-selection box as soon as it's shown! That's
not the way dialogs usually work, so you're going to confuse
people.
Instead, first pop up the file-selection box, and then pop up
the dialog (without the Browse button) to do whatever else it
does after you've got the filename.
Iain
On May 14, 9:37 pm, "David C. Ullrich" <dullr...@sprynet.comwrote:
In article
<a14c2400-e88b-4d90-80bb-a5fe27fed...@m44g2000hsc.googlegroups.com>,
Iain King <iaink...@gmail.comwrote:
Hi. I have a modal dialog whcih has a "Browse..." button which pops
up a file selector. This all works fine, but the first thing the user
has to do when they open the dialog is select a file, so I would like
the dialog to automatically call the onBrowse function as soon as the
dialog opens. However, I don't know how to do this.
dlg.ShowModal()
onBrowse()
obviously doesn't work, and neither does the reverse. I was hoping
that the dialog would throw some kind of "I have been shown" event,
but it doesn't (as far as I can tell). How do I make the dialog do
something as soon as it's been shown?
It's too bad that you found an answer. You _shouldn't_ have your
dialog pop up a file-selection box as soon as it's shown! That's
not the way dialogs usually work, so you're going to confuse
people.
Instead, first pop up the file-selection box, and then pop up
the dialog (without the Browse button) to do whatever else it
does after you've got the filename.
That's actually what happens - the dialog throws EVT_INIT_DIALOG
before it displays itself. Not that I really agree with you. I don't
think that a "do such-and-such dialog" appearing with a "Select file
for such-and-such" file selector on top of it, the file selector being
in focus, is confusing for the user. Actually, I think it'd be
friendlier - the user can see where the data from the file is going,
so has an immediate reminder of what the (generic) file selector is
for. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anand |
last post by:
I am calling a python script from LabVIEW. This is achieved by making
a dll call to python22.dll. It works perfectly well for most of my
code. I now want to throwup dialog boxes from python. It...
|
by: flupke |
last post by:
Hi,
i'm trying to convert my java console app to a python gui.
Now, the only problem i seem to have at the moment are the resizers
for the layout. It seems that for the purpose of what i'm...
|
by: rodmc |
last post by:
I am totally new to Python and WxPython and need to write an
application which can open up an external windows from a plug-in within
GAIM (using pyGAIM). I have managed to hack some code together...
|
by: John Salerno |
last post by:
I'm not exactly sure how to call the method ShowModal(). This is what I
have so far:
--------------
import wx
class InputForm(wx.Frame):
|
by: Tyler |
last post by:
Hello All:
I am currently working on a project to create an FEM model for school.
I was thinking about using wxPython to gather the 12 input variables
from the user, then, after pressing the...
|
by: Daniel Gee |
last post by:
I'm trying to learn WxPython with the tutorial:
http://wiki.wxpython.org/Getting_Started
But I can't seem to get the example for events to work. I pasted the
code they had directly into an...
|
by: Marcpp |
last post by:
Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?
......
def...
|
by: SMALLp |
last post by:
How can i select folder either with wx.FileDialog or with any other. I
managed to fine only how to open files but I need to select folder to
get files from all sub folders.....
Thanks in advance!
|
by: dp_pearce |
last post by:
Hi All,
Apologies if this should be seriously obvious. But I am quite new to
Python and it is not quite so obvious yet.
I have a GUI which will eventually load and display database...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |