-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.py
45 lines (37 loc) · 1.45 KB
/
test.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
# do NOT learn from this file
# import pyretro_gui as rg
__package__ = "pyretro_gui"
from .pyretro_gui import app_state, close_app, MenuBar, MenuItem, DropDown, Container, create_window, window_update, window_render
from .constants import SCREEN_X_POS, SCREEN_Y_POS
import pygame
create_window(640, 480, "copy - untitled_image.png", "testicon2.png", flags = pygame.RESIZABLE)
# rg.create_window(640, 480, "copy - untitled_image.png", "testicon2.png", flags = 0)
surf = pygame.Surface((50, 50))
surf.fill([255] * 3)
img = pygame.image.load("example2.png").convert()
app_state.widgets.append(
Container(SCREEN_X_POS, SCREEN_Y_POS, 600, 400, img)
# Container(SCREEN_X_POS, SCREEN_Y_POS, img.get_width(), img.get_height(), img)
)
app_state.widgets.append(MenuBar([
MenuItem("File", 0, DropDown([
MenuItem("Open", 0, DropDown([
MenuItem("image 1"),
MenuItem("image 2"),
MenuItem("Nested", dropdown = DropDown([
MenuItem("Option 1"),
MenuItem("Option 2"),
MenuItem("Nested deep", dropdown = DropDown([
MenuItem("Option 3"),
MenuItem("Option 4")
], width = 100))
]))
])),
MenuItem("Close", 0, shortcut = "Alt+F4", onclick = close_app)
]) ),
MenuItem("Edit", 0, None),
MenuItem("View", 1, None)
]))
while app_state.running:
window_update()
window_render()