-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
55 lines (46 loc) · 1.38 KB
/
gui.py
File metadata and controls
55 lines (46 loc) · 1.38 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
#----------------------------------------------------#
# *Python browser
# network.py
#----------------
# Loads resources, stores and caches them
#----------------------------------------------------#
import pygame as pg
import render
canvas = None
#----------------------------------------------------#
# *redrawMenu
# redraws GUI elements
def redrawMenu():
global canvas
css_box = render.box( {} )
css_box.autoForText( "Privet-medved", 9 )
css_box.border = ( 10, 0, 10, 0 )
bottom_bar = pg.Surface((640, 32))
bottom_bar.fill((255, 150, 150))
pixarr = pg.PixelArray(bottom_bar)
for y in range(32):
for x in range(640):
pixarr[x, y] = (255, 150 - y * 2, 150 - y * 2)
pixarr.close()
canvas.blit(css_box.render(), (128, 128))
canvas.blit(bottom_bar, (0, 480-32))
pg.display.flip()
#----------------------------------------------------#
# *runWindow
# starts window
def runWindow():
global canvas
canvas = pg.display.set_mode( ( 640, 480 ) )
pg.display.set_caption( "Supertos Browser" )
pg.display.set_icon( pg.image.load("icon.png") )
canvas.fill( (255,255,255) )
#----------------------------------------------------#
# *fetchEvents
# fetches events
def fetchEvents():
while True:
ev = pg.event.poll()
if ev.type == pg.NOEVENT:
break
elif ev.type == pg.QUIT:
quit()