Python Forum

Full Version: Modal window
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
OK, I'll explain the functionality, what would be the best approach then?

User opens a search program, and gets a single-select list(box) with
names of counties, provinces, French "préfectures"., etc.
He clicks on one of them, and the TopLevel opens, showing a list(box)
with all the villages in that county... , for which documents are available (prayer cards, marriage records, etc.)
This is just for info, the user can verify if the location he is interested in, has stuff available.
He can scroll the list f is is long.
The only thing he can do now, is click on the toplevel window close button.
No, he is not supposed to click on a village in the toplevel window,
because data are organised by event type first. (If you want marriage info, you don't look in prayer cards)
(Parish registers are also per type of event, at a lower geo level than village or town)
That's all, no dialog.
Paul

edit: I suppose that I do not need a "mainloop" for this window. Otherwise it throws an error when the window is closed.(tkinter.TclError)
I wouldn't make the viewing window modal, sllowing multiple viewing windows open at the same time.
(Oct-17-2023, 09:40 AM)deanhystad Wrote: [ -> ]I wouldn't make the viewing window modal, sllowing multiple viewing windows open at the same time.
If your reason is programmatical, i need to think about it.
If it is functional, it is not necessary, there are not multiple things to view simultaneously.
...Or I don't understand what you are saying.
Paul
Users have their own needs that may seem odd to you.. Try to not get in their way. If there is a programmatic reason for making the window modal, make it modal. Don't make it modal just because you think there is no reason why anyone would view two counties at the same time.

This happens to me all the time, both as a user and a developer. The more flexible I make things the less time I spend changing the software to allow for unforseen use cases.
(Oct-17-2023, 01:19 PM)deanhystad Wrote: [ -> ]The more flexible I make things the less time I spend changing the software
Point taken !
Paul
(Oct-15-2023, 06:51 AM)DPaul Wrote: [ -> ]Hi,
I'm getting pretty confused, reading about modal windows in tKinter.
I thought it would be simple.

I have an existing app,where users make a selection in a listbox, and go on from there.
However, as an extra service, I would like this selection to trigger a pop-up TopLevel window,
with a rather large amout of text.
That is easy.
BUT, I would like this TopLevel to be modal, so the user has to close it before moving on.

I had hoped that adding some parameter to "topWindow = Toplevel(height=500, width=200)"
would do the trick, but how ?
thanks,
Paul
Use Grab_set:
def StartModalDialog(root_window):
    dialog=tk.Toplevel(root_window)
    dialog.grab_set()
Pages: 1 2