вот решил поиграть с Qt Desinger (GUI для python) когда начал переносить интерфейс на файл .py
пишет в импорте ошибку :
Traceback (most recent call last):
File "main.py", line 12, in <module>
ui = Ui_Dialog()
NameError: name 'Ui_Dialog' is not defined
но модуль есть не понимаю почему подскажите пожалуйста вот код самого дизайна:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\1369546\Desktop\Python Qedit\Sublime.ui'
#
# Created: Tue Mar 24 21:23:36 2020
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(382, 201)
Dialog.setStyleSheet("background-color: white;")
self.lineEdit = QtGui.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(10, 10, 251, 31))
self.lineEdit.setStyleSheet("QLineEdit{\n"
"border: 0px;\n"
"background-color: #1F232B;\n"
"color: white;\n"
"font-size: 13px;\n"
"}\n"
"")
self.lineEdit.setObjectName("lineEdit")
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(270, 10, 101, 31))
self.pushButton.setStyleSheet("QPushButton{\n"
"background-color: #1F232B;\n"
"border: 0px;\n"
"color: white;\n"
"transition: 2s background-color;\n"
"border-radius: 5px;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: #B2232B;\n"
"}")
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "Проверка", None, QtGui.QApplication.UnicodeUTF8))
а вот код для самой программы (этот код в отдельном файле но 1 дериктория):
from PySide import QtCore, QtGui
import sys
from ui import Ui_Dialog
#Create QApplication
app = QtGui.QApplication(sys.argv)
#Create form and init UI
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
#Hook logic
#Run main Loop
sys.exit(app.exec_())