Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How do I prevent master window from being accessed with child window present?

Reply
Thread Tools

How do I prevent master window from being accessed with child window present?

 
 
Marc
Guest
Posts: n/a
 
      08-29-2003
Hi,

I am doing a gui application where child windows pop up with options
after the user selects particular buttons from the master window.
However, the master window is still active underneath the child
window. If they accidentally press the same button again they can get
the same copy of two child windows, and that screws up a bunch of the
database stuff that I am trying to collect.

I have tried using the 'transient' method, and that prevents the
master window from being highlighted. But the user can still push
buttons on the master window if the child window is moved aside.

How do I disable the master window until the child window is closed?

Thanks,
Marc
 
Reply With Quote
 
 
 
 
Cliff Wells
Guest
Posts: n/a
 
      08-29-2003
On Fri, 2003-08-29 at 11:12, Marc wrote:
> Hi,
>
> I am doing a gui application where child windows pop up with options
> after the user selects particular buttons from the master window.
> However, the master window is still active underneath the child
> window. If they accidentally press the same button again they can get
> the same copy of two child windows, and that screws up a bunch of the
> database stuff that I am trying to collect.
>
> I have tried using the 'transient' method, and that prevents the
> master window from being highlighted. But the user can still push
> buttons on the master window if the child window is moved aside.
>
> How do I disable the master window until the child window is closed?


And which GUI toolkit are you using? Most have an option to open a
window as "modal" (although this might be limited to dialogs for your
particular toolkit) which means it retains the focus exclusively until
it's dismissed.

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 (800) 735-0555


 
Reply With Quote
 
 
 
 
Marc
Guest
Posts: n/a
 
      08-30-2003
I guess knowing which kit would help. I am using Tkinter.


"Cliff Wells" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Fri, 2003-08-29 at 11:12, Marc wrote:
> > Hi,
> >
> > I am doing a gui application where child windows pop up with options
> > after the user selects particular buttons from the master window.
> > However, the master window is still active underneath the child
> > window. If they accidentally press the same button again they can get
> > the same copy of two child windows, and that screws up a bunch of the
> > database stuff that I am trying to collect.
> >
> > I have tried using the 'transient' method, and that prevents the
> > master window from being highlighted. But the user can still push
> > buttons on the master window if the child window is moved aside.
> >
> > How do I disable the master window until the child window is closed?

>
> And which GUI toolkit are you using? Most have an option to open a
> window as "modal" (although this might be limited to dialogs for your
> particular toolkit) which means it retains the focus exclusively until
> it's dismissed.
>
> --
> Cliff Wells, Software Engineer
> Logiplex Corporation (www.logiplex.net)
> (503) 978-6726 (800) 735-0555
>
>



 
Reply With Quote
 
Michael Peuser
Guest
Posts: n/a
 
      08-30-2003

"Marc" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> I guess knowing which kit would help. I am using Tkinter.
>

Of course you were usind Tkinter...

(1) You can use the modal approach (have a look how Pmw are doing this.
(2) Disable all your controls in the main widget when you show the child
window.
(3) "withdraw" the main window (this is not iconify!)

Example:
from Tkinter import *

m=Tk()
m.title("Parent")
c=Toplevel(m)
c.title("Child")
Button(c,text="Hello",command=c.destroy).pack()

c.bind("<Destroy>",lambda x:m.deiconify())
# note we need lambda to get rid of the Destroy argument
#we should "bind", because there are many ways a window can be killed

m.withdraw()

mainloop()



 
Reply With Quote
 
Eric Brunel
Guest
Posts: n/a
 
      09-01-2003
Marc wrote:
> Hi,
>
> I am doing a gui application where child windows pop up with options
> after the user selects particular buttons from the master window.
> However, the master window is still active underneath the child
> window. If they accidentally press the same button again they can get
> the same copy of two child windows, and that screws up a bunch of the
> database stuff that I am trying to collect.
>
> I have tried using the 'transient' method, and that prevents the
> master window from being highlighted. But the user can still push
> buttons on the master window if the child window is moved aside.
>
> How do I disable the master window until the child window is closed?


childWindow.grab_set()

HTH
--
- Eric Brunel <(E-Mail Removed)> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How do I prevent my wireless card from being accessed by others? =?Utf-8?B?TVdI?= Wireless Networking 1 07-07-2005 05:34 AM
How to prevent a function in base class being overloaded from child class modemer C++ 20 03-22-2005 04:51 PM
Prevent a webpage being accessed outside a frame. Daniel Javascript 5 01-26-2004 02:33 PM
Prevent a page being accessed outside of a frame Daniel HTML 7 01-25-2004 10:35 PM



Advertisments