I have a simple Application when three frame, How can i keep track of Active frame, such that it shouldn't be pressed twice

I have a very simple application, that i want to engneer into a big one. But
there are 3 frame on the Main frame and those three frame can be invoked
when the buttons are pressed. There is a problem that the buttons can be
pressed more than once and give out more frame.

What i want is that when i button is pressed and the frame is shown the
button should not be pressed again, because it's instance is still active.
In short i want a way of telling the user that Another instance of the
frame is still running please close it first. Not opening multiple frames
all doing the same duty.

And also another problem is that. when i click on the button and the frame
opens and i close it, and even the main frame. My Gnome-terminal still shows
something is running, yet i have closed all the sub frame and the main frame
also. NOTE: "This only happends when i click the button and the another
frame open". But when i don't click any button to open the Frame. MY
Gnome-terminal doens't show any thing.

And iam not using any threads on it

Main POINTS are:
  How can i keep track of Active frame when being called by a button press?
  My gnome-terminal shows something active when i close both the sub and the
main frame.

Here is my source Code that explain what iam saying.
http://wxpython-users.1045709.n5.nabble.com/file/n5714667/Package.py
Package.py

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/I-have-a-simple-Application-when-three-frame-How-can-i-keep-track-of-Active-frame-such-that-it-shoule-tp5714667.html
Sent from the wxPython-users mailing list archive at Nabble.com.

In short i want a way of telling the user that Another instance of the
frame is still running please close it first. Not opening multiple frames
all doing the same duty.

In your main frame, keep a attribute that stoes what frames are
already created -- if you want a staticnumber, it's pretty easy:

in the __init__

self.chatFrame = None

in the button handler:

if self.chatFrame - None:
    self.chatFrame = Chat_Frame_Package(...)
else:
    self.chatFrame.Raise()
    # or do something to alert the user, or...

And also another problem is that. when i click on the button and the frame
opens and i close it, and even the main frame. My Gnome-terminal still shows
something is running, yet i have closed all the sub frame and the main frame
also.

I think yo have a problem because you're creating multiple wx.Apps,
all in one process -- you can't do that, and probably don't want to.
I'm surprised it works at all. Simply remove the:
"app = wx.PySimpleApp()"
call in all your OnStart* methods.

You should only call wx.App() once.

-HTH,
  -Chris

And iam not using any threads on it

and you don't want to/ can't -- all the wx code has to be in one
thread. Other code can be in other threads, but yo need to call back
into the main thread to do any GUI stuff. See the Wiki for "long
running processes"

···

On Tue, Sep 11, 2012 at 4:16 AM, want_learn1 <wangolob@gmail.com> wrote:

Here is my source Code that explain what iam saying.
http://wxpython-users.1045709.n5.nabble.com/file/n5714667/Package.py
Package.py

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

The easy way to give the user that hint would be to disable,
(Enable(False)), the button when you show the frame and in the OnClose
method of the frame enable the button again.

Gadget/Steve

···

On 11/09/2012 12:16 PM, want_learn1 wrote:

I have a very simple application, that i want to engneer into a big one. But
there are 3 frame on the Main frame and those three frame can be invoked
when the buttons are pressed. There is a problem that the buttons can be
pressed more than once and give out more frame.

What i want is that when i button is pressed and the frame is shown the
button should not be pressed again, because it's instance is still active.
In short i want a way of telling the user that Another instance of the
frame is still running please close it first. Not opening multiple frames
all doing the same duty.

I got it pretty fine thanks for that Reply when i removed the App and the main loop it run preety and as you said i kept track using an atribute