Issue
I'm learning PySide6 and I'm trying to create a frameless QInputDialog.
When I set:
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QInputDialog, QMainWindow
app = QApplication()
input_dialog = QInputDialog(flags=Qt.FramelessWindowHint)
text, ok = input_dialog.getText(QMainWindow(), 'input dialog', 'Is this ok?')
if ok:
print(text)
app.exec()
the frame still appears. Why?
Solution
The getText method is static so input_dialog
is not the displayed window but an instance of QInputDialog is created internally, so you must pass the flags through the method:
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QInputDialog
app = QApplication()
text, ok = QInputDialog.getText(
None, "input dialog", "Is this ok?", flags=Qt.FramelessWindowHint
)
if ok:
print(text)
Answered By - eyllanesc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.