May-25-2023, 10:25 AM
(This post was last modified: May-25-2023, 10:36 AM by gnezdavrukavah.)
I stumbled upon this thread from three years ago, and it seems like you were trying to make your dice roller code more appealing using Tkinter. Nice choice!
In your current code, it looks like the total variable is defined outside the roll function, which means it won't update dynamically. To fix this, you'll want to move the lines where you roll the dice and calculate the total inside the roll function itself. That way, each time you click the roll button, the values will be freshly generated.
To update the displayed number, you can use the configure method on the self.result label. Within the roll function, add self.result.configure(text=total) to ensure the label reflects the newly rolled total.
Oh, and by the way, if you're looking for some inspiration or additional guidance, you can always check out FlipSimu's dice roller. They have a fantastic tool that might provide some useful insights.
In your current code, it looks like the total variable is defined outside the roll function, which means it won't update dynamically. To fix this, you'll want to move the lines where you roll the dice and calculate the total inside the roll function itself. That way, each time you click the roll button, the values will be freshly generated.
To update the displayed number, you can use the configure method on the self.result label. Within the roll function, add self.result.configure(text=total) to ensure the label reflects the newly rolled total.
Oh, and by the way, if you're looking for some inspiration or additional guidance, you can always check out FlipSimu's dice roller. They have a fantastic tool that might provide some useful insights.