[Python] open window maked by qt designer from tkinter [closed]

Discussão em 'Python' iniciado por Stack, Janeiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    from tkinter import *
    from PyQt5 import*
    from PyQt5 import uic
    from PyQt5.QtWidgets import QApplication
    import sys

    class Interface:
    def interface(self):
    self.Interface = Tk()
    self.Interface.geometry('200x150')
    btn = Button(self.Interface,text='show ui', command= self.show_ui).pack(expand=True)
    self.Interface.mainloop()

    def show_ui(self):
    self.Interface.destroy()
    Entries().ui_entries

    class Entries:

    def __init__(self):

    app = QApplication(sys.argv)
    self.ui_entries = uic.loadUi('Entrie.ui')

    self.ui_entries.show()



    # close me
    self.ui_entries.btn_exit.clicked.connect(self.show_interface)

    sys.exit(app.exec_())


    def show_interface(self):
    self.ui_entries.close()
    Interface().interface()

    if __name__=="__main__":


    Interface().interface()

    Continue reading...

Compartilhe esta Página