mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Initial revision
This commit is contained in:
parent
6da6aebfdb
commit
453bd408bd
18 changed files with 2990 additions and 0 deletions
44
Demo/sgi/gl/glstdwin/tmenu.py
Normal file
44
Demo/sgi/gl/glstdwin/tmenu.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Test menus
|
||||
|
||||
import stdwingl
|
||||
|
||||
import stdwin
|
||||
from stdwinevents import *
|
||||
|
||||
def main():
|
||||
w = stdwin.open('TestMenus')
|
||||
#
|
||||
items1 = 'Aap', 'Noot', 'Mies'
|
||||
m1 = w.menucreate('Menu-1')
|
||||
for item in items1:
|
||||
m1.additem(item, item[0])
|
||||
#
|
||||
items2 = 'Wim', 'Zus', 'Jet', 'Teun', 'Vuur'
|
||||
m2 = w.menucreate('Menu-2')
|
||||
for item in items2:
|
||||
m2.additem(item, `len(item)`)
|
||||
#
|
||||
m1.enable(1, 0)
|
||||
m2.check(1, 1)
|
||||
#
|
||||
while 1:
|
||||
type, window, detail = stdwin.getevent()
|
||||
if type == WE_CLOSE:
|
||||
break
|
||||
elif type == WE_DRAW:
|
||||
d = w.begindrawing()
|
||||
d.box((50,50), (100,100))
|
||||
del d
|
||||
elif type == WE_MENU:
|
||||
mp, i = detail
|
||||
if mp == m1:
|
||||
print 'Choice:', items1[i]
|
||||
elif mp == m2:
|
||||
print 'Choice:', items2[i]
|
||||
else:
|
||||
print 'Not one of my menus!'
|
||||
elif type == WE_CHAR:
|
||||
print 'Character', `detail`
|
||||
#
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue