wxPython frame

A

Austin

In tkinter, the dialogs has the function grab_set(). That means disable
other windows while it's open.
Is there any function like that in wxPython. I want to use it on my frame.
For example, a.py is main frame. There is a button "config" to open
b.py(config frame).
If the function exists in wxPython, i could put that in b.py when b.py is
open and we couldn't
click a.py. Or any other ways to avoid click a.py when b.py is open.

Thanks a lot.
 
P

Peter Hansen

Austin said:
In tkinter, the dialogs has the function grab_set(). That means disable
other windows while it's open.
Is there any function like that in wxPython. I want to use it on my frame.
For example, a.py is main frame. There is a button "config" to open
b.py(config frame).
If the function exists in wxPython, i could put that in b.py when b.py is
open and we couldn't
click a.py. Or any other ways to avoid click a.py when b.py is open.

The wxPython mailing list is probably a better way to get
good answers to wxPython questions.

-Peter
 
D

Dan Perl

Austin said:
In tkinter, the dialogs has the function grab_set(). That means disable
other windows while it's open.
Is there any function like that in wxPython. I want to use it on my frame.
For example, a.py is main frame. There is a button "config" to open
b.py(config frame).
If the function exists in wxPython, i could put that in b.py when b.py is
open and we couldn't
click a.py. Or any other ways to avoid click a.py when b.py is open.

Thanks a lot.

Your question refers to frames, but I think you may mean dialogs (subclasses
of wx.Dialog). So wx.Dialog.ShowModal( ) may be what you're looking for.
See
http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/wxwin_wxdialog.html#wxdialogshowmodal.

Here is an example with a file dialog from a project I am working on:
dlg = wx.FileDialog(
self,
message="Save file as ...",
defaultDir=os.path.join(os.environ['zigzag_install_dir'],
'config'),
wildcard="Python source (*.py)|*.py",
style=wx.SAVE
)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
# Open the file and write into it
saveFile = file(path, "w")
# [...] removed code that writes into the file
saveFile.close()
dlg.Destroy()

Peter is right though, you may be better off asking questions on wxPython in
the wxPython mailing list (http://www.wxpython.org/maillist.php).

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top