qmainwindow

Python Qt Creator new project base class QMainWindow not showing dynamic form.ui

Python Qt Creator new project base class QMainWindow not showing dynamic form.ui Question: I’ve installed Qt Creator v9.0.1 on Ubuntu 22.04 / Windows 10 and try to create a new project which shows an empty frame and not the loaded form.ui: Screenshot Screencapture Testcase: File | New Project: Application (Qt for Python) | Window UI …

Total answers: 1

Bring to the front the MainWindow in Pyqt5

Bring to the front the MainWindow in Pyqt5 Question: I am dealing with the following problem, while I am having multiple windows open, i would like to build a function linked to a button to bring to the front the Main window. Thank you in advance. import sys from PyQt5 import QtGui from PyQt5.QtWidgets import …

Total answers: 1

Trying to split a main window into two in Python

Trying to split a main window into two in Python Question: I’m learning Python by trying to build a simple plotting application and would like to have two windows in my main screen. I’m using the QSplitter module but am having no luck so far. I’d like the left portion to be used for inputting …

Total answers: 1

Error "bool object has no attribute" python message

Error "bool object has no attribute" python message Question: I have a getFile function which will get the address of the csv file and print the filename in the command console. When I run the function in the main window, I keep getting "’bool’ object has no attribute ‘filename’". Why is this happening? ttreadfile.py from …

Total answers: 1

Manipulating SVG Data in PyQt QMainWindow setStyleSheet- function

Manipulating SVG Data in PyQt QMainWindow setStyleSheet- function Question: I’m working on a UI in PyQt and I want to add a background-image to the MainWindow. Adding the Picture is not the problem, but if I run my code the image is shown multiple times… Here is a short codesnipped: import sys from PyQt5.QtCore import …

Total answers: 1

How to get the screen position of `QMainWindow` and print it?

How to get the screen position of `QMainWindow` and print it? Question: I’m trying to get the screen position of QMainWindow and print the position (x,y) values. I have tried both self.pos() and self.mapToGlobal(self.pos()) and both of these return 0. import sys from PyQt5.QtWidgets import QApplication, QMainWindow class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.resize(400, 200) # …

Total answers: 3

pyqt4 already has a layout. How to 'detect' it or change?

pyqt4 already has a layout. How to 'detect' it or change? Question: I’m trying to set a layout manager. But getting the message: QLayout: Attempting to add QLayout “” to Window “”, which already has a layout How can I change or detect which type the layout is? I’d like to use the boxlayout as …

Total answers: 1

PyQt5 draggable frameless window

PyQt5 draggable frameless window Question: I found an example to set borders on a frameless window, however it’s not draggable. How can I make a frameless window draggable? Especially if I can see an example it’ll be awesome. Here is my example code(normally the code is longer, that’s why there are much libraries just don’t …

Total answers: 6

Capture mouse position outside QMainWindow (without click)

Capture mouse position outside QMainWindow (without click) Question: I tried: self.installEventFilter(self) and: desktop= QApplication.desktop() desktop.installEventFilter(self) With: def eventFilter(self, source, event): if event.type() == QEvent.MouseMove: print(event.pos()) return QMainWindow.eventFilter(self, source, event) In QMainWindow object but nothing conclusive. Do you have any idea? Asked By: Mauricio || Source Answers: Mouse events are initially handled by the window-manager, which …

Total answers: 1