-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
75 lines (58 loc) · 1.86 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
## Imports
import random
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.actionbar import ActionBar, ActionView, ActionPrevious
from kivy.uix.screenmanager import Screen
# KV File
with open("main.kv") as kv:
Builder.load_string(kv.read())
# Main Class
class StdInApp(App):
def developer(self, *args):
self.Popup.open()
def change_color(self, *args):
colors = ["#FF0000","#00FF00","#0000FF","#FFFF00","#FF00FF","#00FFFF", "#FFFFFF"]
color = "".join(random.choice(colors))
if color == self.color_now:
same = True
while same:
color = "".join(random.choice(colors))
if color != self.color_now:
self.ScrollView.ids.colortext.foreground_color = color
self.color_now = color
same = False
else:
self.ScrollView.ids.colortext.foreground_color = color
self.color_now = color
# Build Method
def build(self):
self.color_now = "#FFFFFF"
# Root
root = Screen()
# Action Bar
self.ActionBar = ActionBar(
)
# Text Input
self.ScrollView = ScrollView()
# Popup
self.Popup = Popup()
# Add Widgets
root.add_widget(self.ActionBar)
root.add_widget(self.ScrollView)
# Color Change
self.ActionBar.ids.textColor.on_press = self.change_color
self.ActionBar.ids.dev.on_press = self.developer
# Return Root
return root
# Run
StdInApp().run()
# Developer: Kourva