Hide title/application bar in python Pyside6
-
@jsulm Okay, here it is:
class LegendBar(QWidget): def __init__(self): super(LegendBar, self).__init__() self.setWindowFlag(Qt.FramelessWindowHint) self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool) self.initUI() def initUI(self): self.setWindowTitle("LegendBar") self.setGeometry(1400, 0, 400, 1080) # Set the dimensions of the LegendBar self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # Ensure it's on top self.setStyleSheet("background-color:#3C413C;")
-
@poppypelt12 Is LegendBar your main window (top level window)?
-
@poppypelt12 said in Hide title/application bar in python Pyside6:
self.setWindowFlag(Qt.FramelessWindowHint)
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)If I change the order of these two lines it works for me
-
@poppypelt12 said in Hide title/application bar in python Pyside6:
self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # Ensure it's on top
It ruins the first one, use OR operator:
self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint) -
@mpergand changed it to this, still doesn't work :(
class LegendBar(QWidget): def __init__(self): super(LegendBar, self).__init__() self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool) self.setWindowFlag(Qt.FramelessWindowHint) self.initUI() def initUI(self): self.setWindowTitle("LegendBar") self.setGeometry(1400, 0, 400, 1080) # Set the dimensions of the LegendBar self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint) # Ensure it's on top self.setStyleSheet("background-color:#3C413C;")
-
@poppypelt12 said in Hide title/application bar in python Pyside6:
self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint) # Ensure it's on top
You realize this undoes the work (
Qt.Tool
) in__init__()
, right? Don't know if it makes a difference, but at least get something consistent.P.S.
For now and the future, if you download https://doc.qt.io/qtforpython-6/overviews/qtwidgets-widgets-windowflags-example.html you can play with all the window flags to see all the effects you can get. -
@poppypelt12 Alright so. I changed the width of the pop-up to 880 instead of 1080 and it works now so, i guess its solved!
-
-
@poppypelt12
In your code you show nothing about adding any widgets onto theLegendBar
. Did you put some layout on it? Maybe you just want left-aligned regardless of width?P.S.
Can I buy toilet paper from your app? ;-)