Hello, I need a little help here. I can’t figure out why my label isn’t updating. Essentially, I create a label that has a number value. That works fine. But, with a button push I bring up a modal scene and press another button. This option then dismisses the modal scene, the value that is displayed in the LabelNode is updating in value because it is written to another file, but the value that is being displayed isn’t updating to the new value. I’ll try to copy and paste the functions that I think are the most important.
First, here is the LabelNode created in the setup() for the Scene:
mad_spend_label = str(self.maddex_accounts[7])
self.Maddex_spending_amount = LabelNode(mad_spend_label, font=menu_button_font, color='black', position=(-(self.menu_bg.size.w/3), self.menu_bg.size.h/2 - 160), parent=self.menu_bg)
This is the function that is called when said button is pushed:
def run_weekly(self):
self.paused = True
self.run_weekly_scene = BudgetClasses.WeeklySubMenuScene("Weekly Payout", "Who gets paid?",["Both", "Maddex", "Ryker", "Back"])
self.present_modal_scene(self.run_weekly_scene)
self.run_weekly_scene = None
self.update_labels()
Here is a function I created trying to get it to display the correct value:
def update_labels(self):
self.maddex_accounts, self.ryker_accounts = BudgetClasses.TransMethod.get_budget_values()
self.Maddex_spending_amount.text = str(self.maddex_accounts[7])
self.Maddex_savings_amount.text = str(self.maddex_accounts[8])
self.Maddex_tithing_amount.text = str(self.maddex_accounts[9])
self.Ryker_spending_amount.text = str(self.ryker_accounts[7])
self.Ryker_savings_amount.text = str(self.ryker_accounts[8])
self.Ryker_tithing_amount.text = str(self.ryker_accounts[9])
Here is the function that is called from the WeeklySubMenuScene that is presented:
def weekly_both(self):
#[0 kid, 1 ID, 2 date, 3 desc, 4 begin_spend, 5 begin_save, 6 begin_tithe, 7 end_spend, 8 end_save, 9 end_tithe]
maddex_accounts, ryker_accounts = TransMethod.get_budget_values()
new_mad_accounts = self.apply_weekly(maddex_accounts)
new_ryk_accounts = self.apply_weekly(ryker_accounts)
TransMethod.send_mad_trans(new_mad_accounts)
TransMethod.send_ryker_trans(new_ryk_accounts)
self.dismiss_modal_scene()
self.paused = False
So, when that function is run it is successful because the updated values are written to a separate file, but that updated value wont display. If I close the program and then start it again then it displays the updated value that is retrieved from the separate file. I’d like for the value of that LabelNode to update! Any help would be appreciated.