Уведомления

Группа в Telegram: присоединиться
  • Начало
  • » GUI
  • » Как рястянуть text Edit на всё окно PyQt5 [RSS Feed]

#1 Фев. 10, 2019 17:01:51

Horrendous
Зарегистрирован: 2019-02-10
Сообщения: 2
Репутация: +  0  -
Профиль   Отправить e-mail  

Как рястянуть text Edit на всё окно PyQt5

#делал через qt Designer
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(“MainWindow”)
MainWindow.resize(418, 446)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(“centralwidget”)
self.fontComboBox = QtWidgets.QFontComboBox(self.centralwidget)
self.fontComboBox.setGeometry(QtCore.QRect(0, 0, 171, 22))
self.fontComboBox.setObjectName(“fontComboBox”)

self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
self.textEdit.setGeometry(QtCore.QRect(13, 20, 341, 331))
self.textEdit.setAutoFillBackground(False)
self.textEdit.setObjectName(“textEdit”)

MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 418, 21))
self.menubar.setObjectName(“menubar”)
self.FIle = QtWidgets.QMenu(self.menubar)
self.FIle.setObjectName(“FIle”)
self.Format = QtWidgets.QMenu(self.menubar)
self.Format.setObjectName(“Format”)
self.actionAvtor = QtWidgets.QMenu(self.menubar)
self.actionAvtor.setObjectName(“actionAvtor”)
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName(“statusbar”)
MainWindow.setStatusBar(self.statusbar)
self.actionCreate = QtWidgets.QAction(MainWindow)
self.actionCreate.setObjectName(“actionCreate”)
self.actionOpen = QtWidgets.QAction(MainWindow)
self.actionOpen.setObjectName(“actionOpen”)
self.actionSave = QtWidgets.QAction(MainWindow)
self.actionSave.setObjectName(“actionSave”)
self.actionClose = QtWidgets.QAction(MainWindow)
self.actionClose.setObjectName(“actionClose”)
self.actionFont = QtWidgets.QAction(MainWindow)
self.actionFont.setObjectName(“actionFont”)
self.FIle.addAction(self.actionCreate)
self.FIle.addAction(self.actionOpen)
self.FIle.addAction(self.actionSave)
self.FIle.addSeparator()
self.FIle.addAction(self.actionClose)
self.Format.addAction(self.actionFont)
self.menubar.addAction(self.FIle.menuAction())
self.menubar.addAction(self.Format.menuAction())
self.menubar.addAction(self.actionAvtor.menuAction())

self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate(“MainWindow”, “Текстовый редактор”))
self.FIle.setTitle(_translate(“MainWindow”, “Файл”))
self.Format.setTitle(_translate(“MainWindow”, “Формат”))
self.actionAvtor.setTitle(_translate(“MainWindow”, “Об авторе”))
self.actionCreate.setText(_translate(“MainWindow”, “Новый Файл”))
self.actionOpen.setText(_translate(“MainWindow”, “Открыть”))
self.actionSave.setText(_translate(“MainWindow”, “Сохранить”))
self.actionClose.setText(_translate(“MainWindow”, “Выход”))
self.actionFont.setText(_translate(“MainWindow”, “Шрифт”))

#Это основная программа которая вызывает данный интерфейс
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(“MainWindow”)
MainWindow.resize(418, 446)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(“centralwidget”)
self.fontComboBox = QtWidgets.QFontComboBox(self.centralwidget)
self.fontComboBox.setGeometry(QtCore.QRect(0, 0, 171, 22))
self.fontComboBox.setObjectName(“fontComboBox”)

self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
self.textEdit.setGeometry(QtCore.QRect(13, 20, 341, 331))
self.textEdit.setAutoFillBackground(False)
self.textEdit.setObjectName(“textEdit”)

MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 418, 21))
self.menubar.setObjectName(“menubar”)
self.FIle = QtWidgets.QMenu(self.menubar)
self.FIle.setObjectName(“FIle”)
self.Format = QtWidgets.QMenu(self.menubar)
self.Format.setObjectName(“Format”)
self.actionAvtor = QtWidgets.QMenu(self.menubar)
self.actionAvtor.setObjectName(“actionAvtor”)
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName(“statusbar”)
MainWindow.setStatusBar(self.statusbar)
self.actionCreate = QtWidgets.QAction(MainWindow)
self.actionCreate.setObjectName(“actionCreate”)
self.actionOpen = QtWidgets.QAction(MainWindow)
self.actionOpen.setObjectName(“actionOpen”)
self.actionSave = QtWidgets.QAction(MainWindow)
self.actionSave.setObjectName(“actionSave”)
self.actionClose = QtWidgets.QAction(MainWindow)
self.actionClose.setObjectName(“actionClose”)
self.actionFont = QtWidgets.QAction(MainWindow)
self.actionFont.setObjectName(“actionFont”)
self.FIle.addAction(self.actionCreate)
self.FIle.addAction(self.actionOpen)
self.FIle.addAction(self.actionSave)
self.FIle.addSeparator()
self.FIle.addAction(self.actionClose)
self.Format.addAction(self.actionFont)
self.menubar.addAction(self.FIle.menuAction())
self.menubar.addAction(self.Format.menuAction())
self.menubar.addAction(self.actionAvtor.menuAction())

self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate(“MainWindow”, “Текстовый редактор”))
self.FIle.setTitle(_translate(“MainWindow”, “Файл”))
self.Format.setTitle(_translate(“MainWindow”, “Формат”))
self.actionAvtor.setTitle(_translate(“MainWindow”, “Об авторе”))
self.actionCreate.setText(_translate(“MainWindow”, “Новый Файл”))
self.actionOpen.setText(_translate(“MainWindow”, “Открыть”))
self.actionSave.setText(_translate(“MainWindow”, “Сохранить”))
self.actionClose.setText(_translate(“MainWindow”, “Выход”))
self.actionFont.setText(_translate(“MainWindow”, “Шрифт”))

Прикреплённый файлы:
attachment slog.py (3,5 KБ)

Офлайн

  • Начало
  • » GUI
  • » Как рястянуть text Edit на всё окно PyQt5[RSS Feed]

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version