PyQt - Widget in QtGui.QtMainWindow
I have a window(QtGui.QMainWindow) that I'm trying to add text, but I know
you can't add text to a window in pyqt so im adding a widget into the
window but the widget isnt showing up only the dialog
here is the window code:
class MyWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MyWindow, self).__init__(parent)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
QtCore.Qt.WindowStaysOnTopHint)
self.setWindowOpacity(.9)
text_widget = text(self)
self.widgets = QtGui.QStackedWidget()
self.widgets.addWidget(text_widget)
self.setStyleSheet("QMainWindow { background: 'black'}");
and here is the widget I'm trying to add:
class text(QtGui.QWidget):
def __init__(self, parent=None):
super(text, self).__init__(parent)
self.label1 = QtGui.QLabel('Welcome')
layout = QtGui.QHBoxLayout()
layout.addWidget(self.label1)
self.setLayout(layout)a
and if needed i can post the whole code that displays the dialog window
that i want to show up with the main window. the main window is full
screen with an opacity lowered as its I'm trying to add an background so
you cant exit out of my log in screen the dialog displays a frameless
window so it cant be moved around. and i want the dialog to be displayed
along with the widget
here is the whole code for somebody that may need it for timesake as its
quite long i just pasted it on bpaste
http://bpaste.net/show/Xus3ME83YTjiEK4gnqRu/
No comments:
Post a Comment