-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapiTry.py
More file actions
35 lines (24 loc) · 1.19 KB
/
apiTry.py
File metadata and controls
35 lines (24 loc) · 1.19 KB
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
import justpy as jp
from modules.weather import getWeather
from modules.currency import getRate
def weather_click(self, msg):
self.message.text = getWeather()
self.message.classes = 'bg-red-500 text-xl my-4'
def rate_click(self, msg):
self.message.text = getRate()
self.message.classes = 'bg-blue-500 text-xl my-4'
def event_demo():
wp = jp.WebPage()
button_div = jp.Div(classes='flex m-4 flex-wrap', a=wp)
w_button_classes = 'bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 border border-blue-700 rounded ' \
'mr-2 '
r_button_classes = 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 border border-blue-700 ' \
'rounded mr-2 '
w_message = jp.Div(text='Click ↑ button to get weather condition', classes='text-xl my-4', a=wp)
r_message = jp.Div(text='Click ↑ button to get currency', classes='text-xl my-4', a=wp)
bw = jp.Button(text='Weather', a=button_div, classes=w_button_classes, click=weather_click)
bw.message = w_message
br = jp.Button(text='Currency', a=button_div, classes=r_button_classes, click=rate_click)
br.message = r_message
return wp
jp.justpy(event_demo)