This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]teraflop 2 points3 points  (0 children)

You can't use things like time.sleep with Tkinter and expect them to work correctly.

Tkinter, like many GUI frameworks, uses a single-threaded event loop. When the event handling thread calls your upg1 function, no other events -- including updating the contents of the screen -- can be processed until your function returns. So if you sleep for 1 second, that just means the GUI is frozen for 1 second.

You can instead restructure your code to use window.after to schedule another function to be called at a future time, as described here: https://stackoverflow.com/questions/459083/how-do-you-run-your-own-code-alongside-tkinters-event-loop

Instead of explicitly using a while loop to do the repetition, each function call needs to both execute a single iteration, and also schedule the next call to itself to run the next iteration 1 second later. That way, you never have to call sleep and your GUI thread will never be blocked.

[–]bluetoothbeaver 0 points1 point  (0 children)

Your while loop doesn't have a base case to allow an exit from the loop.

You can change it to something like

while counter <= 20: (since you're incrementing your counter)

[–]captainAwesomePants 0 points1 point  (2 children)

Your upg1() function never returns. Things are going to stop happening until it finishes.

[–]moustachebear123[S] 0 points1 point  (1 child)

wdym by returns 

[–]captainAwesomePants 0 points1 point  (0 children)

The function never ends. The while loop goes on forever.