-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.kv
More file actions
62 lines (52 loc) · 3.41 KB
/
main.kv
File metadata and controls
62 lines (52 loc) · 3.41 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<MainScreen>:
name: 'main' #t his must match name given to SCREEN_MANAGER
# Example of a basic DPEAButton, use this as reference. No need to modify.
# FYI: A DPEAButton is a Kivy Button + a Kivy Label merged into one widget with default appearance settings.
# See here documentation (https://github.com/dpengineering/RaspberryPiCommon/tree/master/pidev/kivy)
# DPEAButton:
# id: some_name_button (used to easily identify and change attributes of the button in the python script)
# size: width_in_px, height_in_px (ex: root.btn_x, root.btn_y)
# center_x: x_pos_of_center_of_button (can also use 'x' instead of center_x if you want to set the location by the bottom right corner)
# center_y: y_pos_of_center_of_button (can also use 'y' instead of center_y if you want to set the location by the bottom right corner)
# on_press: root.your_function_here() (add a callback function here)
# color: Red, Green, Blue, Alpha (Transparency) [Numbers range from 0 to 1, not 0 to 255] sets text color
# fill_color: same as above but sets the overall color of button
# border_color: sets border color of button
# Example of a basic Label, use this as reference. No need to modify.
# Label:
# id: some_name_text
# halign: 'desiredDirection' (Horizontally align the text ['left', 'right', or 'center']
# font_size: ##
# text: "Your desired text"
# color: Red, Green, Blue, Alpha (Transparency) [Numbers range from 0 to 1, not 0 to 255]
# pos_hint: {"x": (##), "y": (##)} (used to adjust the position of the label)
# size_hint: (1, 0.2) [This will shrink area in which the slider can be adjusted to be more appropriate to the actual size of the slider]
Slider:
# TODO: Use the Kivy docs (https://kivy.org/doc/stable/api-kivy.uix.slider.html) to create a slider with the following:
# TODO: Add id of 'position', min of -100, max of 100, step of 1, and set the position to the bottom center of the screen
size_hint: (1, 0.05)
pos_hint: {"y": 1/2}
Label:
# TODO: Add the id of 'slider_text'.
# TODO: uncomment the text attribute below to set the text to display the slider value
# TODO: set color attribute to 'black'
# text: (str(int(-position.value)) + "%\nCCW") if position.value < 0 else (str(int(position.value)) + "%\nCW") if position.value > 0 else (str(int(position.value)) + "%")
DPEAButton:
# TODO: Add the id of 'change_button' and a callback to switch_screen().
# TODO: For the text, horizontally align center, add the text of "Joystick Screen".
# TODO: Position the button to an open spot on the screen
DPEAButton:
# TODO: Add the id of 'counter_button' and a callback to counter_action().
# TODO: For the text, horizontally align center, set text to "0".
DPEAButton:
# TODO: Add the id of 'servo_motor_button' and a callback to schedule_servo_motor().
# TODO: Make fill color red
# TODO: For the text, horizontally align center, add the text of "Servo Motor OFF".
DPEAButton:
# TODO: Add the id of 'stepper_motor_button' and a callback to schedule_stepper_motor().
# TODO: Make fill color red
# TODO: For the text, horizontally align center, add the text of "Stepper Motor OFF".
<Slider>:
# Helpful modifications to the base slider class
value_track: True
value_track_color: 0.5, 0.5, 0.5, 1