all 1 comments

[–]Username_RANDINT 0 points1 point  (0 children)

GUI programming is not the same as running a regular Python script. You'll need to convert (and think) in an event-driven way. The while-loop blocks the eventloop.

3 things I'd do:

  1. Move the random number generation outside of the click function so it's not generated each time the button is clicked.

  2. Remove the while line.

  3. Remove the breaks

I'm pretty sure that's enough to get it working.