示例#1
0
    'Save',
    'Quit',
)
def handle_menu(e):
    print 'Menu event: %s.%d: %s' % (e.name,e.item_id,e.text)
    if e.name == 'Main':
        if e.text == 'Save':
            stddraw.save(_surface)
        if e.text == 'Quit':
            quit()

## Main loop.
stddraw.createWindow()
stddraw.setXscale(-1.0, 1.0)
stddraw.setYscale(-1.0, 1.0)
stddraw.circle(0, 0, 0.5)
stddraw.show()
_surface = pygame.Surface.copy(stddraw._surface)

while 1:
    stddraw.clear()
    stddraw.circle(0, 0, 0.5)

    for e in pygame.event.get():
        if e.type == MOUSEBUTTONUP:
            ## Blocking popup menu.
            PopupMenu(menu_data)
        elif e.type == USEREVENT:
            if e.code == 'MENU':
                handle_menu(e)
    
示例#2
0
import stddrawpygame
import pygame

#-------------------------------------------
# testing client
stddrawpygame.createWindow()
stddrawpygame.setFontFamily("calibri")
stddrawpygame.setFontSize(20)

stddrawpygame._pixel(0.5, 0.5)
stddrawpygame.circle(0.5, 0.5, 0.25)
stddrawpygame.square(0.5, 0.5, 0.5)
stddrawpygame.rectangle(0.3, 0.2, 0.2, 0.2)

stddrawpygame.text(0.75, 0.75, "hello my name is kuni")

stddrawpygame.save()
while True:
    stddrawpygame.show()
示例#3
0
import stddrawpygame
import pygame

#-------------------------------------------
# testing client
stddrawpygame.createWindow()
stddrawpygame.setFontFamily("calibri")
stddrawpygame.setFontSize(20)

stddrawpygame._pixel(0.5, 0.5)
stddrawpygame.circle(0.5, 0.5, 0.25)
stddrawpygame.square(0.5, 0.5, 0.5)
stddrawpygame.rectangle(0.3, 0.2, 0.2, 0.2)

stddrawpygame.text(0.75, 0.75, "hello my name is kuni")

stddrawpygame.save()
while True:
	stddrawpygame.show()