-
Notifications
You must be signed in to change notification settings - Fork 95
/
clickdemo.py
53 lines (43 loc) · 1.05 KB
/
clickdemo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
Created on 2022-08-27
@author: wf
"""
import justpy as jp
class ClickDemo:
"""
demo for click handling
"""
async def onDivClick(self, msg):
"""
handle a click on the Div
"""
print(msg)
self.clickCount += 1
msg.target.text = f"I was clicked {self.clickCount} times"
async def click_demo(self):
"""
the example Webpage under test
"""
wp = jp.WebPage(debug=True)
self.clickCount = 0
d = jp.Div(
text="Not clicked yet",
a=wp,
classes="w-48 text-xl m-2 p-1 bg-blue-500 text-white",
)
d.on("click", self.onDivClick)
d.additional_properties = [
"screenX",
"pageY",
"altKey",
"which",
"movementX",
"button",
"buttons",
]
return wp
async def click_demo():
clickDemo = ClickDemo()
return await clickDemo.click_demo()
from examples.basedemo import Demo
Demo("click demo", click_demo)