aroberge / easygui_qt

Inspired by easygui, designed for PyQt
BSD 3-Clause "New" or "Revised" License
60 stars 18 forks source link

hidden window problem #16

Open jeremygray opened 9 years ago

jeremygray commented 9 years ago

At least on Mac 10.9.5, python 2.7.8, various dialogs typically appear underneath another window (= invisible). For the launcher.py demo, I can make the main launcher appear on top of the terminal window that I call it from by adding 3 lines to the end of class Dialog.__init__:

self.show()
self.raise_()
self.activateWindow()

To have various functions in easygui_qt.py show up on top after launching, instead of everything in one line (here forget_string()):

text, ok = QtGui.QInputDialog().getText(None, title, message,
                                      QtGui.QLineEdit.Normal,
                                      default_response, flags)

this works for me:

dialog = QtGui.QInputDialog()
dialog.show()
dialog.raise_()
text, ok = dialog.getText(None, title, message,
                                      QtGui.QLineEdit.Normal,
                                      default_response, flags)

I just committed a version of this to a temp branch. If it works in python 3 and non-Mac I'll tweak the other functions. (I presume its already showing on top properly, so my question is whether things break or not when adding these calls.)

aroberge commented 9 years ago

I'll look at this tomorrow morning (already almost 1am here). Just looking at this your code, it makes a lot of sense and is something I can do as well. I might actually remove the with_app decorator at the same time. I had introduced it so as to avoid having to repeat something like 3 lines of code for every functions ... but it messes up the signature of the function on http://easygui-qt.readthedocs.org/en/latest/api.html . I'll go through each function one by one tomorrow.

aroberge commented 9 years ago

I fixed many of the widgets. For some of them, attempting to do an explicit show()/raise_() series of calls resulted in a default window showing first which was then replaced by the appropriate window. However, I used a Qt flag (QtCore.Qt.WindowStaysOnTopHint) in many places; this should help to solve this problem. I could not use this flag for all widgets - but perhaps some already include it by default behind the scene.

stephenboulet commented 9 years ago

It's an issue for Windows 7 too. I did a pull today.

two_windows

from easygui_qt import *
from sys import exit

s = get_string('Enter a string')

print("String entered was %s" % s)
if s == "None":
    exit()
input()```
tengerdata commented 7 years ago

I guess, this bug was never fixed. It's still happening. But, I see the last unanswered post about the hidden window was a year ago, so should I assume that the easygui_qt is an abandoned project?

aroberge commented 7 years ago

@tengerdata Unfortunately, you are essentially correct. I haven't found the time to work on this project for a long time. It was mostly done as a learning experience, and I haven't found a need for it (not yet, at least).