-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui_image_screener.py
59 lines (51 loc) · 1.82 KB
/
gui_image_screener.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
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.graphics import *
from kivy.core.window import Window
from screeninfo import get_monitors
# for m in get_monitors():
monitor = get_monitors()[0]
print(monitor.width,monitor.height)
print(Window.system_size)
# Window.size = (300, 200)
class MainWindow(BoxLayout):
def __init__(self):
super().__init__()
self.button = Button(text="Hello, World?")
self.button.bind(on_press=self.handle_button_clicked)
self.add_widget(self.button)
self._keyboard = Window.request_keyboard(self._keyboard_closed, self)
self._keyboard.bind(on_key_down=self._on_keyboard_down)
# self.canvas.before.clear()
with self.canvas:
Color(1, 0, 0)
Rectangle(pos=(50,50), size=(600,600))
Color(1, 1, 1)
BorderImage(
size=( 600, 600),
pos=( 50, 50),
# borders: (5, 'solid', (1,0,0,1)),
source='./pictures/818_heatmap.png')
def _keyboard_closed(self):
self._keyboard.unbind(on_key_down=self._on_keyboard_down)
self._keyboard = None
def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
print(keycode[1],text)
# if keycode[1] == 'w':
# self.player1.center_y += 10
# elif keycode[1] == 's':
# self.player1.center_y -= 10
# elif keycode[1] == 'up':
# self.player2.center_y += 10
# elif keycode[1] == 'down':
# self.player2.center_y -= 10
return True
def handle_button_clicked(self, event):
self.button.text = "Hello, World!"
class MyApp(App):
def build(self):
self.title = "Hello, World!"
return MainWindow()
app = MyApp()
app.run()