一个典型的pyqt5的窗口代码

主窗体代码

# -*- coding:utf-8 -*-

import os
import sys
from PyQt5.uic import loadUi
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QWidget, QDialog, QMainWindow
from PyQt5 import QtWidgets


class kdMarkdownPad(QMainWindow):
    def __init__(self):
        super().__init__()
        loadUi("kdMarkdownPad.ui", self)


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    win = kdMarkdownPad()
    win.show()
    sys.exit(app.exec_())
 

子窗口代码

#-*- coding:utf-8 -*-

import os

from PyQt5.uic import loadUi
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import  QWidget,QDialog

class addconfig(QWidget):
    """  """

    def __init__ (self):
        super().__init__()
        loadUi("addconfig.ui", self)
        self.config_path = os.environ[‘HOME’] + ".config/kdssh/"

 

Author: bkdwei