Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pop_screen() triggering randomly after hoovering buttons under heavy load #4613

Closed
matkudela opened this issue Jun 6, 2024 · 16 comments
Closed

Comments

@matkudela
Copy link

matkudela commented Jun 6, 2024

I noticed strange behavior while hoovering very fast on many buttons. pop_screen is being triggered ramdomly only under heavy load on my computer (used stress command). Tried same thing with push_screen but works fine.
Example used in video:

from __future__ import annotations

from textual import on
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.screen import Screen, ScreenResultType
from textual.widgets import Button
from textual.containers import Horizontal


class MyApp(App):

    def compose(self) -> ComposeResult:
        yield Button("next screen", variant="success")

    @on(Button.Pressed)
    def next_screen(self):
        self.app.push_screen(Screen2())


class Screen2(Screen[ScreenResultType]):
    BINDINGS = [Binding("escape", "other_screen", "next")]

    def compose(self) -> ComposeResult:
        with Horizontal():
            yield Button("1", variant="success")
            yield Button("2", variant="primary")
            yield Button("3", variant="error")
            yield Button("4", variant="success")
            yield Button("5", variant="primary")
            yield Button("6", variant="error")

    def action_other_screen(self):
        self.app.pop_screen()

MyApp().run()

Since github is accepting files under 10MB im linking video: https://drive.google.com/file/d/1qG4SCLF-0-HXDOMNLBCrGF4lFM7Lxlxj/view?usp=drivesdk

Copy link

github-actions bot commented Jun 6, 2024

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@davep
Copy link
Contributor

davep commented Jun 6, 2024

My initial reaction to this would be that it's unlikely that it's a case of "pop_screen() triggering randomly after hoovering buttons under heavy load" and very possibly a case of an instance of escape being detected and processed as keyboard input.

@matkudela
Copy link
Author

You are right, just tested it.

@willmcgugan
Copy link
Collaborator

Can you paste the result of textual diagnose please.

@matkudela
Copy link
Author

matkudela commented Jun 6, 2024

Textual Diagnostics

Versions

Name Value
Textual 0.62.0
Rich 13.7.0

Python

Name Value
Version 3.10.12
Implementation CPython
Compiler GCC 11.4.0
Executable /home/dev/.pyenv/versions/3.10.12/envs/clive_venv/bin/python3.10

Operating System

Name Value
System Linux
Release 6.5.0-15-generic
Version #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2

Terminal

Name Value
Terminal Application Terminator
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=105, height=56
legacy_windows False
min_width 1
max_width 105
is_terminal True
encoding utf-8
max_height 56
justify None
overflow None
no_wrap False
highlight None
markup None
height None

@willmcgugan
Copy link
Collaborator

@matkudela Could you try running with TEXTUAL_DEBUG=1 to reproduce the issue, then sending us the keys.log file that it generates.

@matkudela
Copy link
Author

You mean opening textual keys app?
image
If no where I can find the logs?

@willmcgugan
Copy link
Collaborator

run your app with TEXTUAL_DEBUG=1 python myapp.py Reproduce the issue and exit. You should find keys.log in the working directory.

@matkudela
Copy link
Author

keys.log

@willmcgugan
Copy link
Collaborator

You have a slightly older version of Textual. Would you mind upgrading to the latest, and repeating the test?

@matkudela
Copy link
Author

Upgraded to 0.65.2, works same way keys.log

@willmcgugan
Copy link
Collaborator

I'm not certain if this will fix it, but please try 0.66.0

@matkudela
Copy link
Author

Didn't help.

@willmcgugan
Copy link
Collaborator

Please try Textual 0.71.0

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@matkudela
Copy link
Author

Most of the time works fine but managed to recreate this problem once in 15 minutes of testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants