#๐Ÿ”’ graphics window unresponsive

65 messages ยท Page 1 of 1 (latest)

dreamy mothBOT
#

@distant axle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

distant axle
#

@uncut cosmos this is majoirity of it

uncut cosmos
#

I don't see a main call.

distant axle
#

yh i have that below but the character limit

uncut cosmos
#

!paste

dreamy mothBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

distant axle
uncut cosmos
#

At what point does it cease being responsive?

distant axle
#

it opens up

uncut cosmos
#

Do you get to your first input call, for example?

distant axle
#

2 seconds later it beomces unresponsive

#

oh yes

#

after loading up the file and all the data processing

uncut cosmos
#

How large is the csv file?

distant axle
#

i have 3

#

one is 98 KB

#

one 8

#

and another 75

uncut cosmos
#

Okay, so negligible.

distant axle
#

i dont think its to do with my computer

uncut cosmos
#

It does to ask.

distant axle
#

because ive tried solely the graphics window on another idle

#

it worked fine but when i tried again in my main code its just becomes unresponsive

#

looked everywhere for a solution but to no avail

uncut cosmos
#

I have a suspicion.

#

Let me just look at the code for a bit more.

obsidian oriole
#

Idk what graphics is, but you should almost certainly be calling win.update() very regularly. I suspect that as soon as input prevents it from being called, the window will freeze.

uncut cosmos
#

Not according to the docs.

#

re: update

#

But yes.

#

input would block, but I think it's threaded

obsidian oriole
#

Oh, it spawns its own thread? That's rarer.

uncut cosmos
#

I don't see a mainloop call in the examples.

#

It's tkinter.

#

So I think they've hidden that away.

#

There's an autoflush parameter.

#

True by default.

distant axle
#

Would i need to add that to the creation of the window?

uncut cosmos
#

Nono.

#

We're just contemplating outwardly.

distant axle
#

oh o

#

ok

obsidian oriole
dreamy mothBOT
#

graphics.py line 185

_root = tk.Tk()```
uncut cosmos
#

Maybe use Matplotlib or Seaborn?

#

There are plenty of use examples on matplltlib's site.

distant axle
#

will do just was unsure why this didnt work

uncut cosmos
#

Granted, matplotlib is also tkinter.

#

But I think it's probably more established as a data display library.

distant axle
#

Yeah im gonna try matplotlib and see

#

I do really appreciate the help

obsidian oriole
obsidian oriole
obsidian oriole
#

If it doesn't spawn its own thread, I don't see how else it would work. update seems to process queued events like mainloop, but is sketchier. I'm wondering if things lock when the queues fill or something.

distant axle
obsidian oriole
#

That tracks. When writing UIs, your code needs to execute as quickly as possible to give CPU time back to the graphics library so it can do important things, like redraw the window and respond to events. As soon as you having "blocking" code like input that prevents the code from advancing, you're preventing the library from updating the window, so it freezes.

#

If you need blocking work, you need to typically offload that onto a new thread.

#

Or just ask for input using the ways the library provides instead of input.

distant axle
#

will look into this more now

#

thanks

obsidian oriole
#

You're welcome.

dreamy mothBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.