Closed A-tichat closed 4 years ago
A simple code is I want to go to the next page when I press a button.
It is better to code this in nextion editor.
For library to receive any touch events you need to check Send Component ID
for required event. Otherwise no event is transmitted.
I sorry that makes you misunderstand. A code next page is an example of simple nextion command.
Actually, my code is a password checker. I must get the password from a text block then check it with my database before going to the next page. So, I must take action within python code.
Please, help me solve this problem.
I guess you have a button that need to start fetching password from a text block then decide what to do.
On this button in onPress event you need to check Send Component ID
checkmark.
Then when you press it on the nextion, panel will send this touch event to python event_handler
function
Alright, This is my nextion screen. https://drive.google.com/file/d/16cd0n6_nT9fj2T4caBunfEFUIOYmIXON/view?usp=sharing
and this is my python code https://raw.githubusercontent.com/A-tichat/raspberry-pi-mrz/master/display/simple.py
I use this code on raspberry pi 4 b that output is error https://drive.google.com/file/d/1zlUrVSDPjKkEwmcesgFCsTGdwWpBHZwF/view?usp=sharing
Ahh, event_handler
should not be async.
it is a callback.
If you want async you can do inside event_handler
asyncio.create_task(async_event_handler(....))
But make sure you catch all exceptions there, otherwise they will be just supressed.
That is what I wanted. Thank you very much for your help.
Hello
I'm using nextion display to make some projects. I'm trying so much to find out about library nextion for python then I found your library.
It easy to understand for me. but have some functions that I don't know how to use.
A simple code is I want to go to the next page when I press a button. This I trying.
and I add global to run()
It dosen't work and I don't any have idea.