Изображение текущего приложения
Прикрепленное выше изображение моего заявления, которое я делаю. В настоящее время текст в QPushButton
обрезается в моем боковом меню, и мне нужен полный текст для отображения. Вот мой код в настоящее время:
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
import sys
stylesheet = """
QWidget{
background-color: white;
}
QWidget#sideMenuBackground{
background-color: #f7f7f7;
}
QVBoxLayout#sideMenuLayout{
background-color: grey;
}
QPushButton#sideMenuButton{
text-align: left;
border: none;
background-color: #f7f7f7;
max-width: 10em;
font: 16px;
padding: 6px;
}
QPushButton#sideMenuButton:hover{
font: 18px;
}
QLabel#today_label{
font: 25px;
max-width: 70px;
}
QLabel#todays_date_label{
font: 11px;
color: grey;
}
QPushButton#addTodoEventButton{
border: none;
max-width: 130px;
}
"""
class MyWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Public Transport Application")
self.setGeometry(200, 200, 800, 500)
self.showMaximized()
self.initUI()
def initUI(self):
backgroundWidget = QtWidgets.QWidget()
backgroundWidget.setObjectName('sideMenuBackground')
backgroundWidget.setFixedWidth(300)
layout = QtWidgets.QHBoxLayout()
layout.addWidget(backgroundWidget)
sideMenuLayout = QtWidgets.QVBoxLayout()
sideMenuLayout.setObjectName('sideMenuLayout')
self.taskLayout = QtWidgets.QStackedLayout()
backgroundWidget.setLayout(sideMenuLayout)
layout.addLayout(self.taskLayout)
self.setSideMenu(sideMenuLayout)
sideMenuLayout.addStretch(0)
self.setMainLayout(self.taskLayout)
mainWidget = QtWidgets.QWidget()
mainWidget.setLayout(layout)
self.setCentralWidget(mainWidget)
def setSideMenu(self, layout):
self.AButton = QtWidgets.QPushButton('Account')
self.IJUPTButton = QtWidgets.QPushButton('I Just Used Public Transport')
self.CTTOTButton = QtWidgets.QPushButton('Compare the Types of Transport')
self.LSButton = QtWidgets.QPushButton('License Statistics')
self.AdminButton = QtWidgets.QPushButton('Admin Viewing')
self.OPPButton = QtWidgets.QPushButton('Our Privacy Policy')
sideMenuButtons = [self.AButton, self.IJUPTButton, self.CTTOTButton, self.LSButton, self.AdminButton, self.OPPButton]
for button in sideMenuButtons:
button.setObjectName('sideMenuButton')
layout.addWidget(button)
sideMenuButtons[0].pressed.connect(self.AButtonPress)
sideMenuButtons[1].pressed.connect(self.IJUPTButtonPress)
sideMenuButtons[2].pressed.connect(self.CTTOTButtonPress)
sideMenuButtons[3].pressed.connect(self.LSButtonPress)
sideMenuButtons[4].pressed.connect(self.AdminButtonPress)
sideMenuButtons[5].pressed.connect(self.OPPButtonPress)
def setMainLayout(self, layout):
Accounts = self.AccountsWidget()
IJUPT = self.IJUPTWidget()
CTTOT = self.CTTOTWidget()
LS = self.LSWidget()
Admin = self.AdminWidget()
OPP = self.OPPWidget()
layout.addWidget(Accounts)
layout.addWidget(IJUPT)
layout.addWidget(CTTOT)
layout.addWidget(LS)
layout.addWidget(Admin)
layout.addWidget(OPP)
def AccountsWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for today's widget
return widget
def IJUPTWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for calendar widget
return widget
def CTTOTWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for calendar widget
return widget
def LSWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for calendar widget
return widget
def AdminWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for calendar widget
return widget
def OPPWidget(self):
widget = QtWidgets.QWidget(self)
layout = QVBoxLayout(widget)
# setup layout for calendar widget
return widget
def AButtonPress(self):
self.taskLayout.setCurrentIndex(0)
def IJUPTButtonPress(self):
self.taskLayout.setCurrentIndex(1)
def CTTOTButtonPress(self):
self.taskLayout.setCurrentIndex(2)
def LSButtonPress(self):
self.taskLayout.setCurrentIndex(3)
def AdminButtonPress(self):
self.taskLayout.setCurrentIndex(4)
def OPPButtonPress(self):
self.taskLayout.setCurrentIndex(5)
def main():
app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(stylesheet)
win = MyWindow()
win.show()
app.exec_()
main()
Буду признателен за помощь. Спасибо!