How to bring dialogue box window to appear at the front in Tkinter module of Python?

Viewed 397

I am using Python 2.7 Tkinter module to create a GUI. In this GUI there are two windows:

  1. Dialogue box which asks user to enter something.
  2. Main user interface that loads up after user enters value.

The problem that I am facing is that the 2nd window appears before the 1st window such that the 2nd window covers up the whole 1st window so I literally have to drag out the 2nd window to enter the value in the 1st window such that the 2nd window loads up. How do I make sure that the 1st window i.e the Dialogue box always appear at the front.

This is the code of the Dialogue box window.

top = TK()
value += tkSimpleDialog.askstring("Fruit", "Enter fruit number: e.g 3", parent=top)
1 Answers

Use top.lift() this will get your window to the front.

Related