Python Forum
dice roller with tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dice roller with tkinter
#6
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.
Reply


Messages In This Thread
dice roller with tkinter - by g0g0g1g - Sep-02-2020, 08:07 PM
RE: dice roller with tkinter - by deanhystad - Sep-02-2020, 08:12 PM
RE: dice roller with tkinter - by g0g0g1g - Sep-02-2020, 08:15 PM
RE: dice roller with tkinter - by deanhystad - Sep-02-2020, 10:54 PM
RE: dice roller with tkinter - by g0g0g1g - Sep-03-2020, 07:00 PM
RE: dice roller with tkinter - by gnezdavrukavah - May-25-2023, 10:25 AM
RE: dice roller with tkinter - by DeaD_EyE - May-25-2023, 12:42 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020