I am making a pygame dialog and i have files that are like that:
window.py:
class Window():
def set_size(self, size):
self.size = size
main_window = Window()
dialogs.py:
from window import main_window
class Question():
def __init__(self):
# lots of initializing
self.position = (main_window.size[0] / 2, main_window.size[1] / 2) # centering dialog
question = Question()
other files:
from window import main_window
from dialogs import question
# do something
The problem is that if i change the size of the main window in one of the other files, then the question dialog will no longer be centered, since question is already initialized with a different screen size. So, i want to make the set_size method reload the question module for all other files. How can i do this?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire