0

I am using python guidata ( https://code.google.com/p/guidata/ ) package to get user inputs. The problem is the gui window does not come on top. It stays hidden under other windows. I think there should be some windows modality argument that I can pass. I just cant find them. Not sure if it is relevant, but I am not running the python script directly, what i am running is basically a bat file which runs

python.exe myscript.py

I would like to have the window come on top (preferable) or the window to be modal ( next best solution )

Added Later : to give a sample code I am just pasting an example from the guidata website. My code is more or less similar

import guidata
_app = guidata.qapplication() # not required if a QApplication has already been created

import guidata.dataset.datatypes as dt
import guidata.dataset.dataitems as di

class Processing(dt.DataSet):
    """Example"""
    a = di.FloatItem("Parameter #1", default=2.3)
    b = di.IntItem("Parameter #2", min=0, max=10, default=5)
    type = di.ChoiceItem("Processing algorithm",
                         ("type 1", "type 2", "type 3"))

param = Processing()
param.edit()

The line param.edit() displays the gui but just not on the top

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Abhijit Ray
  • 105
  • 1
  • 6
  • I've never used the library but very very worst case scenario you could use the win32api to lift the window. – Wayne Werner Feb 26 '15 at 13:10
  • Related: http://stackoverflow.com/questions/6087887/bring-window-to-front-raise-show-activatewindow-don-t-work – ivan_pozdeev Feb 26 '15 at 13:22
  • possible duplicate of [How to make a PyQT4 window jump to the front?](http://stackoverflow.com/questions/12118939/how-to-make-a-pyqt4-window-jump-to-the-front) – ivan_pozdeev Feb 26 '15 at 13:23
  • I am not using pyqt directly. All pyqt parts should preferably be transparently handled by guidata without me kwowing about it. – Abhijit Ray Feb 26 '15 at 13:26
  • 1
    @AbhijitRay. If you "don't want to know about it" your question is off-topic for SO, which is concerned with solving programming problems, rather than issues with third-party software. Please therefore direct your queries to the [guidata discussion group](https://groups.google.com/forum/#!forum/guidata_guiqwt). – ekhumoro Feb 26 '15 at 18:38

1 Answers1

0

From the docs and this answer

from guidata.qt.QtGui import QMainWindow, QSplitter
# snip a lot of code
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
# more snipping

if __name__ == '__main__':
    from guidata.qt.QtGui import QApplication
    import sys
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    # these two lines presumably will bring the window to the front
    window.setWindowState(window.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)

    # this will activate the window
    window.activateWindow()
    sys.exit(app.exec_())

I'm not sure if those extra lines will be needed - I'm unfamiliar with PyQT, but it looks like that should do what you want.

Community
  • 1
  • 1
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290