Z
Z
zaordu2021-04-15 10:16:14
Python
zaordu, 2021-04-15 10:16:14

How to pass data from parent window to child window?

The bottom line is, in window1 I authorize the user and I need to transfer his data (login and password) to window2 , and then to window3 where it will be possible to edit the account data. I thought that I would get by with the usual import of a variable, but since my windows import data like this

window1--->window2--->window3

i can’t get data from window3 to window1, it turns out like a vicious circle and pycharm
swears this is a crutch and I don’t really want to do it.
Is there any option to pass login and password data in a variable to subsequent windows? This is also not a particularly beautiful solution, but at least the application will somehow work, and for my coursework this is more than enough.

And another question is how it is implemented humanly in real projects? In order not to create such a nightmare in the future.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bbkmzzzz, 2021-04-15
@bbkmzzzz

A class that stores authorization information - an instance in the field of the main class, when creating child ones - pass it to __init__, do not forget to write it in the field
Mixins
Store information in the field of the class, not the instance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question