tkinter передача информации между окнами

Решил написать свое первое приложение на tkinter и сразу же столкнулся с проблемой. Имеются два окна(Main и Recount), одно из которых дочернее. На родительском окне есть виджет Canvas, на котором надо нарисовать круг, а под кругом текст. Текст должен совпадать с тем, что пользователь введет в self.state_of_recount в дочернем окне Recount. Собственно вопрос, как это сделать, должно происходить все по нажатию кнопки apply. Код прилагается

import tkinter as tk
from tkinter import ttk
from const import *
class Main(tk.Frame):

    def __init__(self, root):
        super().__init__(root)
        self.init_main()

    def init_main(self): #fubction for built main window


        self.stats_circle = tk.Canvas(self,bg="red", width=650)
        self.stats_circle.pack()

        top_block = tk.Frame(bg = "black", bd = 2)
        top_block.pack(side = tk.TOP, fill = tk.X)

        btn_recount = tk.Button(top_block,text = "add" ,command = self.open_recount , compound = tk.TOP, bd = 0)  #button is open recount window
        btn_recount.pack(side = tk.LEFT)

        btn_goal = tk.Button(top_block, text = "goals", command = self.open_goal, compound = tk.TOP) #button is open goals window
        btn_goal.pack(side = tk.LEFT)

        btn_account = tk.Button(top_block, text = "account", command = self.open_account, compound = tk.TOP, bd = 0)
        btn_account.pack(side = tk.LEFT)

    def create_cicle_of_state(self): #создание категории
          mass_for_circle[0] += 30
          self.stats_circle.create_oval(mass_for_circle[0], mass_for_circle[1], mass_for_circle[2], mass_for_circle[3]) # mass_for_circle - массив координат импортируется из файла

    def create_descrip_for_circle(self, text):  #создание категории
        self.dialog = Recount()
        mass_of_text_for_circle[0] += 30
        self.stats_circle.create_text(mass_of_text_for_circle[0], mass_of_text_for_circle[1], text=text)  


    def open_recount(self):
        Recount()

    def open_goal(self):
        Goal()

    def open_account(self):
        Account()


# окно ввода денег
class Recount(tk.Toplevel):


    def __init__(self):
        super().__init__(root)
        self.init_recount()

    def init_recount(self): #function for built recount window

        self.geometry("400x220")
        self.title("окно номер 2")
        self.resizable(False, False)

        self.money = ttk.Entry(self) #add money
        self.money.place(x=200, y=50)

        self.state_of_recount = ttk.Entry(self) #add state of earninig or spending
        self.state_of_recount.place(x=200, y=110)

        self.select_box = ttk.Combobox(self, values=['spending', 'earning']) #selestion of spending or earning
        self.select_box.current(1)
        self.select_box.place(x=200, y=80)

        self.describ_money = ttk.Label(self, text = "money") #describtion for  self.money
        self.describ_money.place(x=150, y=50)

        self.describ_state = ttk.Label(self, text="state") #description for  self.state_of_recoun
        self.describ_state.place(x=150, y=110)

        self.describ_box = ttk.Label(self, text= "earning/spending") # description for box
        self.describ_box.place(x = 100, y = 80)

        self.btn_exit = tk.Button(self, text = "exit", command=self.destroy)
        self.btn_exit.place(x = 300,y = 170)


        self.btn_add = tk.Button(self, text = "apply")
        self.btn_add.place(x = 220, y=170)

        self.grab_set()
        self.focus_set()

Ответы (0 шт):