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

Python example SimulateTouch #223

Open
Al4He6 opened this issue Jul 20, 2024 · 1 comment
Open

Python example SimulateTouch #223

Al4He6 opened this issue Jul 20, 2024 · 1 comment

Comments

@Al4He6
Copy link

Al4He6 commented Jul 20, 2024

Cannot access local variable i

@Al4He6
Copy link
Author

Al4He6 commented Jul 23, 2024

Needs I to be global correctly,
and touch down and up to trigger InTouch function,
also it seems to try and animate repeatedly.
This simulates one touch

from native import app

btn = ""

def OnStart():
global btn
lay = app.CreateLayout( "linear", "VCenter,FillXY" )

btn = app.AddButton( lay,"Touch me",0.3, 0.1 )
btn.SetOnTouch( btn_OnTouch )

app.AddLayout( lay )

app.SimulateTouch( btn, 0.5, 0.5, "down" )
app.SimulateTouch( btn, 0.5, 0.5, "up" )

def btn_OnTouch():
app.ShowPopup( "Button has been touched" ,"long")

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

1 participant