Post Reply 
Python: some practice, questions and #%§'
05-15-2021, 11:05 PM (This post was last modified: 05-16-2021 10:19 AM by Guenter Schink.)
Post: #3
RE: Python: some practice, questions and #%§'
(05-15-2021 01:04 AM)jkor Wrote:  I seem to have some success with the following snippet in PPL:



The snippet prints the y-coord of the mouse pointer for a two-point touch, or the key code for a clicked calculator key and can be exited by pressing 'On'. Both mouse() and keyboard() don't seem to accept any parameters.

As noted in one of your previous posts, I haven't had any luck making a Python script file work (using the More>Files>New Program feature of the Editor).

Thanks for your invaluable contributions to the knowledge base. Your posted have been very helpful in trying to figure things out.

Thanks for your comment, and the code snipped, that helped a lot. Now I have a routine for mouse, at least on the virtual Prime, that seems to work reliably and easy to use. Checking out on the real Prime will follow. For now I call it a day, although I should call it a night at 1 hour past midnight here.

from hpprime import *
# So far only tested on the Virtual.
# Left mouse button returns first tuple
# Right mouse button returns second tuple

# initiate Maus as 1 tuple of 2 tuples
# and wait for a mouse event
# Maus is the German word for mouse :-)
while Maus==((),()):

# clear terminal Window as it fits, guess that's what you were looking for

#split Maus into two tuples Maus1 and Maus2
# in Python it's easy this way

#let's see what we got

#before doing something with first tuple, 
#check  it's not empty
if Maus1>():

#before doing something with second tuple, 
#check  it's not empty
if Maus2>():

EXPORT test7(a)
  PYTHON(name1, a);

We'll continue to play with Python, no?
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Python: some practice, questions and #%§' - Guenter Schink - 05-15-2021 11:05 PM

User(s) browsing this thread: 1 Guest(s)