#๐Ÿ”’ Tkinter button : going through a video frame by frame but i have to press twice on it to work

35 messages ยท Page 1 of 1 (latest)

shell phoenixBOT
#

@hollow plume

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.

#

Hey @hollow plume!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
viscid mist
#

!paste

shell phoenixBOT
#
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.

viscid mist
#

Can you put it in a pastebin so I can see it all at once?

hollow plume
#

Yes

viscid mist
#

So you need to press the buttons twice to get it to go to the previous or next frame?

hollow plume
#

Yes that's the issue

#

I want to only have to press it once

viscid mist
#

is it just the frames or does the play/pause have the same issue?

hollow plume
#

Just the frames pause button works fine

viscid mist
#

okay, so it's probably either an off-by-one error or needing cv2 to re-render. Let me dig into it a bit

hollow plume
#

Appreciate

viscid mist
hollow plume
#

Of course let me send you the remaining

viscid mist
#

@hollow plume Do you have the Controller code? Just missing that bit to the get the initialization correct

hollow plume
#

Forgot about it

viscid mist
#

@hollow plume I'm not getting the behavior you're describing. I can press it once and it'll change frames. What OS are you on?

hollow plume
#

Windows 11

viscid mist
#

Hmmm, I'm on Win10. But the changing frames is working just fine with one button press

hollow plume
#

Damn

#

While we're at it how can i make such a messagebox ? Tkinter messagebox doesn't work

#

An exit dialog

viscid mist
#

Your exit dialog works for me

#

or do you mean when you try to "X" out of it instead of through the menu?

viscid mist
#

You need specifically this under Application:

class Application(tk.Tk):
    def __init__(self):
        ...  #all of your code
        self.protocol("WM_DELETE_WINDOW", self.on_closing)

    def on_closing(self):
        if messagebox.askokcancel("Quit", "Do you want to quit?"):
            self.destroy()

It's a bit finnicky but you need that base tk.Tk instance to bind a message box function to the WM_DELETE_WINDOW event

hollow plume
#

Thanks

hollow plume
#

Is there any way to customize the buttons in tk.messagebox.askyesnocancel ?

shell phoenixBOT
#
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.