如何从列表(ttk.Notebook)中调用类公式?

I have two python files: entrepreneur.py and main.py.

The first one have a class with a tkinter form (input general information about the person).

The second file is a main file that have many tabs (tkinter Notebook).

我想从第一个文件中的类调用第一个选项卡中的类,但是当我运行应用程序时,公式编制器显示在新窗口中,而不是第二个文件的选项卡中。

entrepreneur.py:

from tkinter import *
from calendar import *


class Entrepreneur:
    def __init__(self, master):
        self.master = master
        self.msg=Label(master,fg='red')
        self.msg1=Label(master,fg='red')
        self.msg2=Label(master,fg='red')

        self.titre = Label(master, text='Information Générales',font="Helvetica 50 bold italic")
        self.titre.place(x=150,y=10)

        # le nom et prenom -----------------------------------------------------

        self.myName = Label(master, text='Nom & Prénom:').place(x=10,y=110)
        self.myNameValue = Entry(master, width=30)
        self.myNameValue.place(x=150,y=110)

        # la date de naissance -------------------------------------------------

        self.date_de_naissance = Label(master, text='Date de Naissance:')
        self.date_de_naissance.place(x=10, y=140)
        self.day_value = Spinbox(master ,from_ =1,to_ = 31,width=4,state='readonly')
        self.day_value.place(x=120,y=140)

        # dictionnaire les noms du mois avec leurs numeros ---------------------

        self.month_list={"Janvier":1,"Fevrier":2,"Mars":3,"Avril":4,"May":5,"Juin":6,"Juillet":7,"Aout":8,"September":9,"October":10,"November":11,"Décember":12}
        self.month_value= Spinbox(master,state='readonly',values=("Janvier","Fevrier","Mars","Avril","May","Juin","Juillet","Aout","September","October","November","Décember"),width=8)
        self.month_value.place(x=170,y=140)
        self.year_value= Spinbox(master,from_=1900,to_=2100,width=4,state='readonly')
        self.year_value.place(x=250,y=140)

main.py:

from tkinter import *
from tkinter.ttk import *
from entrepreneur import Entrepreneur


windows =Tk()
windows.title("Plan d'affaire ")
#windows.geometry("600*400")

frame1 = Frame(windows)
frame1.place(x=0,y=200)
frame2 = Frame(windows)
frame2.place(x=0,y=0)


tablayout = Notebook(frame1)

#tab promoteur
tab1 =Frame(tablayout)
tab1.pack(fill="both")
tablayout.add(tab1,text="Promoteur")

titre = Label(tab1, text='Information Générales',font="Helvetica 50 bold italic")
titre.place(x=150,y=400)

#tab etude marché
tab2 =Frame(tablayout)
tab2.pack(fill="both")
tablayout.add(tab2,text="etude marché")

#tab etude technique
tab3 =Frame(tablayout)
tab3.pack(fill="both")
tablayout.add(tab3,text="etude technique")
评论