Exemplo n.º 1
0
def main():
	#
	stdwin.setdefwinsize(300, 300)
	stdwin.setdefwinpos(0, 0)
	if color: stdwin.setbgcolor(YELLOW)
	w1 = stdwin.open('Hello, world')
	w1.box = (10, 10), (90, 90)
	#
	stdwin.setdefwinsize(0, 0)
	stdwin.setdefwinpos(50, 50)
	if color: stdwin.setbgcolor(GREEN)
	w2 = stdwin.open('Second window')
	w2.box = (10, 10), (90, 90)
	#
	while w1 or w2:
		type, window, detail = stdwin.getevent()
		if type == WE_DRAW:
			d = window.begindrawing()
			if window == w1:
				if color: d.setfgcolor(BLACK)
				d.box(((50, 50), (250, 250)))
				if color: d.setfgcolor(RED)
				d.cliprect(((50, 50), (250, 250)))
				d.paint(w1.box)
				d.noclip()
				if color: d.setfgcolor(BLUE)
				d.line((0, 0), w1.box[0])
			elif window == w2:
				if color: d.setfgcolor(WHITE)
				d.box(w2.box)
				if color: d.setfgcolor(BLACK)
				d.text(w2.box[0], 'Hello world')
			else:
				print 'Strange draw???', window, detail
			del d
		elif type == WE_CLOSE:
			if needclose: window.close()
			if window == w1:
				w1 = None
			elif window == w2:
				w2 = None
			else:
				print 'weird close event???', window, detail
		elif type in (WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP):
			h, v = detail[0]
			window.box = (h, v), (h+80, v+80)
			window.change(((0,0), (2000, 2000)))
		elif type == WE_CHAR:
			print 'character', `detail`
		else:
			print type, window, detail
Exemplo n.º 2
0
def main():
    #
    stdwin.setdefwinsize(300, 300)
    stdwin.setdefwinpos(0, 0)
    if color: stdwin.setbgcolor(YELLOW)
    w1 = stdwin.open('Hello, world')
    w1.box = (10, 10), (90, 90)
    #
    stdwin.setdefwinsize(0, 0)
    stdwin.setdefwinpos(50, 50)
    if color: stdwin.setbgcolor(GREEN)
    w2 = stdwin.open('Second window')
    w2.box = (10, 10), (90, 90)
    #
    while w1 or w2:
        type, window, detail = stdwin.getevent()
        if type == WE_DRAW:
            d = window.begindrawing()
            if window == w1:
                if color: d.setfgcolor(BLACK)
                d.box(((50, 50), (250, 250)))
                if color: d.setfgcolor(RED)
                d.cliprect(((50, 50), (250, 250)))
                d.paint(w1.box)
                d.noclip()
                if color: d.setfgcolor(BLUE)
                d.line((0, 0), w1.box[0])
            elif window == w2:
                if color: d.setfgcolor(WHITE)
                d.box(w2.box)
                if color: d.setfgcolor(BLACK)
                d.text(w2.box[0], 'Hello world')
            else:
                print 'Strange draw???', window, detail
            del d
        elif type == WE_CLOSE:
            if needclose: window.close()
            if window == w1:
                w1 = None
            elif window == w2:
                w2 = None
            else:
                print 'weird close event???', window, detail
        elif type in (WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP):
            h, v = detail[0]
            window.box = (h, v), (h + 80, v + 80)
            window.change(((0, 0), (2000, 2000)))
        elif type == WE_CHAR:
            print 'character', ` detail `
        else:
            print type, window, detail
Exemplo n.º 3
0
def main():
    stdwin.setdefwinsize(NCOLS * stdwin.textwidth('12345'), \
       NROWS * stdwin.lineheight() * 3)
    w = stdwin.open('TestColors')
    #
    while 1:
        type, window, detail = stdwin.getevent()
        if type == WE_CLOSE:
            print 'Bye.'
            break
        elif type == WE_SIZE:
            w.change((0, 0), (10000, 10000))
        elif type == WE_DRAW:
            width, height = w.getwinsize()
            d = w.begindrawing()
            for row in range(NROWS):
                for col in range(NCOLS):
                    color = row * NCOLS + col
                    d.setfgcolor(color)
                    p = col * width / NCOLS, row * height / NROWS
                    q = (col+1)*width/NCOLS, \
                     (row+1)*height/NROWS
                    d.paint((p, q))
                    d.setfgcolor(0)
                    d.box((p, q))
                    d.text(p, ` color `)
                    p = p[0], p[1] + d.lineheight()
                    d.setfgcolor(7)
                    d.text(p, ` color `)
            del d
Exemplo n.º 4
0
 def __init__(self):
     # For server
     self.server_name = None
     # Windowing state
     self.window = stdwin.open('WWWW - by Guido van Rossum')
     self.window.setwincursor(WAITCURSOR)
     self.last_mouse_down = None
     self.last_msg = ''
     # Current document state
     self.cur_addr = ''
     self.cur_data = ''
     self.cur_anchors = []
     self.cur_anchornames = []
     self.cur_anchortypes = []
     self.cur_isindex = 0
     self.cur_backend = None
     # User state
     self.raw_mode = 0
     # Logging state
     self.history = []
     # Menus
     self.history_menu = None
     self.anchors_menu = None
     self.make_command_menu()
     self.make_bookmarks_menu()
     # Register us for events
     self.window.dispatch = self.dispatch
     mainloop.register(self.window)
     allwindows.append(self)
     # Initialize cur_backend
     self.setrawdata('', '')
Exemplo n.º 5
0
	def __init__(self):
		# For server
		self.server_name = None
		# Windowing state
		self.window = stdwin.open('WWWW - by Guido van Rossum')
		self.window.setwincursor(WAITCURSOR)
		self.last_mouse_down = None
		self.last_msg = ''
		# Current document state
		self.cur_addr = ''
		self.cur_data = ''
		self.cur_anchors = []
		self.cur_anchornames = []
		self.cur_anchortypes = []
		self.cur_isindex = 0
		self.cur_backend = None
		# User state
		self.raw_mode = 0
		# Logging state
		self.history = []
		# Menus
		self.history_menu = None
		self.anchors_menu = None
		self.make_command_menu()
		self.make_bookmarks_menu()
		# Register us for events
		self.window.dispatch = self.dispatch
		mainloop.register(self.window)
		allwindows.append(self)
		# Initialize cur_backend
		self.setrawdata('', '')
Exemplo n.º 6
0
def open(title):  # Open a generic window
    w = stdwin.open(title)
    stdwin.setdefwinsize(0, 0)
    # Set default event handlers
    w.draw = nop
    w.char = nop
    w.mdown = nop
    w.mmove = nop
    w.mup = nop
    w.m2down = m2down
    w.m2up = m2up
    w.size = nop
    w.move = nop
    w.activate = w.deactivate = nop
    w.timer = nop
    # default command handlers
    w.close = close
    w.tab = tab
    w.enter = enter
    w.backspace = backspace
    w.arrow = arrow
    w.kleft = w.kup = w.kright = w.kdown = nop
    w.dispatch = treatevent
    register(w)
    return w
Exemplo n.º 7
0
def main():
	stdwin.setdefwinsize(NCOLS * stdwin.textwidth('12345'), \
				NROWS * stdwin.lineheight() * 3)
	w = stdwin.open('TestColors')
	#
	while 1:
		type, window, detail = stdwin.getevent()
		if type == WE_CLOSE:
			print 'Bye.'
			break
		elif type == WE_SIZE:
			w.change((0,0), (10000, 10000))
		elif type == WE_DRAW:
			width, height = w.getwinsize()
			d = w.begindrawing()
			for row in range(NROWS):
				for col in range(NCOLS):
					color = row*NCOLS + col
					d.setfgcolor(color)
					p = col*width/NCOLS, row*height/NROWS
					q = (col+1)*width/NCOLS, \
						(row+1)*height/NROWS
					d.paint((p, q))
					d.setfgcolor(0)
					d.box((p, q))
					d.text(p, `color`)
					p = p[0] , p[1]+ d.lineheight()
					d.setfgcolor(7)
					d.text(p, `color`)
			del d
Exemplo n.º 8
0
def open(title):			# Open a generic window
	w = stdwin.open(title)
	stdwin.setdefwinsize(0, 0)
	# Set default event handlers
	w.draw = nop
	w.char = nop
	w.mdown = nop
	w.mmove = nop
	w.mup = nop
	w.m2down = m2down
	w.m2up = m2up
	w.size = nop
	w.move = nop
	w.activate = w.deactivate = nop
	w.timer = nop
	# default command handlers
	w.close = close
	w.tab = tab
	w.enter = enter
	w.backspace = backspace
	w.arrow = arrow
	w.kleft = w.kup = w.kright = w.kdown = nop
	w.dispatch = treatevent
	register(w)
	return w
Exemplo n.º 9
0
def main():
	size = 12
	w = stdwin.open('Font chart ' + `size`)
	while 1:
		type, window, detail = stdwin.getevent()
		if type == WE_CLOSE:
			break
		if type == WE_DRAW:
			width, height = w.getwinsize()
			d = w.begindrawing()
			d.setsize(size)
			h, v = 0, 0
			for c in range(32, 256):
				ch = chr(c)
				chw = d.textwidth(ch)
				if h + chw > width:
					v = v + d.lineheight()
					h = 0
					if v >= height:
						break
				d.text((h, v), ch)
				h = h + chw
			del d
		if type == WE_MOUSE_UP:
			size = size + 1
			w.settitle('Font chart ' + `size`)
			w.change((0, 0), (2000, 2000))
Exemplo n.º 10
0
def testStdwin():
	import stdwin, fmt
	from stdwinevents import *
	if sys.argv[1:]: file = sys.argv[1]
	else: file = 'test.html'
	data = open(file, 'r').read()
	window = stdwin.open('testStdwin')
	b = None
	while 1:
		etype, ewin, edetail = stdwin.getevent()
		if etype == WE_CLOSE:
			break
		if etype == WE_SIZE:
			window.setdocsize(0, 0)
			window.setorigin(0, 0)
			window.change((0, 0), (10000, 30000)) # XXX
		if etype == WE_DRAW:
			if not b:
				b = fmt.StdwinBackEnd(window, 1)
				f = fmt.BaseFormatter(b.d, b)
				p = FormattingParser(f, \
							    MacStylesheet)
				p.feed(data)
				p.close()
				b.finish()
			else:
				b.redraw(edetail)
	window.close()
Exemplo n.º 11
0
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`
Exemplo n.º 12
0
 def __init__(self):
     if macspeech:
         self.speaker = MacSpeaker()
     else:
         self.speaker = None
     sys.stdin = open('SCRIPT', 'r')
     self.acts = readscript(sys.stdin)
     maxactor = 0
     for actorlist, actdata in self.acts:
         if len(actorlist) > maxactor:
             maxactor = len(actorlist)
     if not self.loadnextact():
         print 'No acts to play!'
         raise done
     self.lh = stdwin.lineheight()
     self.winheight = (maxactor + 2) * self.lh
     stdwin.setdefwinsize(WINWIDTH, self.winheight)
     self.win = stdwin.open('The Play')
     self.win.setdocsize(WINWIDTH, self.winheight)
     self.win.change(((0, 0), (WINWIDTH, self.winheight)))
     self.menu = self.win.menucreate('Play')
     self.menu.additem('Faster', '+')
     self.menu.additem('Slower', '-')
     self.menu.additem('Quit', 'Q')
     self.speed = 4
Exemplo n.º 13
0
	def __init__(self):
		if macspeech:
			self.speaker = MacSpeaker()
		else:
			self.speaker = None
		sys.stdin = open('SCRIPT', 'r')
		self.acts = readscript(sys.stdin)
		maxactor = 0
		for actorlist, actdata in self.acts:
			if len(actorlist) > maxactor:
				maxactor = len(actorlist)
		if not self.loadnextact():
			print 'No acts to play!'
			raise done
		self.lh = stdwin.lineheight()
		self.winheight = (maxactor+2)*self.lh
		stdwin.setdefwinsize(WINWIDTH, self.winheight)
		self.win = stdwin.open('The Play')
		self.win.setdocsize(WINWIDTH, self.winheight)
		self.win.change(((0,0),(WINWIDTH, self.winheight)))
		self.menu = self.win.menucreate('Play')
		self.menu.additem('Faster', '+')
		self.menu.additem('Slower', '-')
		self.menu.additem('Quit', 'Q')
		self.speed = 4
Exemplo n.º 14
0
def testStdwin():
    import stdwin, fmt
    from stdwinevents import *
    if sys.argv[1:]: file = sys.argv[1]
    else: file = 'test.html'
    data = open(file, 'r').read()
    window = stdwin.open('testStdwin')
    b = None
    while 1:
        etype, ewin, edetail = stdwin.getevent()
        if etype == WE_CLOSE:
            break
        if etype == WE_SIZE:
            window.setdocsize(0, 0)
            window.setorigin(0, 0)
            window.change((0, 0), (10000, 30000))  # XXX
        if etype == WE_DRAW:
            if not b:
                b = fmt.StdwinBackEnd(window, 1)
                f = fmt.BaseFormatter(b.d, b)
                p = FormattingParser(f, \
                       MacStylesheet)
                p.feed(data)
                p.close()
                b.finish()
            else:
                b.redraw(edetail)
    window.close()
Exemplo n.º 15
0
	def realize(self):
		if self.win:
			raise Error, 'realize(): called twice'
		if not self.child:
			raise Error, 'realize(): no child'
		# Compute suggested size
		self.size = self.child.getminsize(self.beginmeasuring(), \
						  self.size)
		save_defsize = stdwin.getdefwinsize()
		scrwidth, scrheight = stdwin.getscrsize()
		width, height = self.size
		if width > scrwidth:
			width = scrwidth * 2/3
		if height > scrheight:
			height = scrheight * 2/3
		stdwin.setdefwinsize(width, height)
		self.hbar, self.vbar = stdwin.getdefscrollbars()
		self.win = stdwin.open(self.title)
		stdwin.setdefwinsize(save_defsize)
		self.win.setdocsize(self.size)
		if self.itimer:
			self.win.settimer(self.itimer)
		width, height = self.win.getwinsize()
		if self.hbar:
			width = self.size[0]
		if self.vbar:
			height = self.size[1]
		self.child.setbounds(((0, 0), (width, height)))
		self.child.realize()
		self.win.dispatch = self.dispatch
		mainloop.register(self.win)
Exemplo n.º 16
0
def openlistwindow(dirname):
	list = posix.listdir(dirname)
	list.sort()
	i = 0
	while i < len(list):
		if list[i] == '.' or list[i] == '..':
			del list[i]
		else:
			i = i+1
	for i in range(len(list)):
		name = list[i]
		if path.isdir(path.join(dirname, name)):
			list[i] = list[i] + '/'
	width = maxwidth(list)
	width = width + stdwin.textwidth(' ')	# XXX X11 stdwin bug workaround
	height = len(list) * stdwin.lineheight()
	stdwin.setdefwinsize(width, min(height, 500))
	w = stdwin.open(dirname)
	stdwin.setdefwinsize(0, 0)
	w.setdocsize(width, height)
	w.drawproc = drawlistwindow
	w.mouse = mouselistwindow
	w.close = closelistwindow
	w.dirname = dirname
	w.list = list
	w.selected = -1
	return w
Exemplo n.º 17
0
def main():
	player = cd.open()
	stdwin.setdefscrollbars(0, 0)
	win = stdwin.open('CD')
	win.player = player
	win.dispatch = cddispatch
	mainloop.register(win)
	win.settimer(10)
	mainloop.mainloop()
Exemplo n.º 18
0
def show_hook(self):
       savetext = self.text
       self.settext('Be patient...')
       close_sogram()
       stdwin.setdefwinsize(400, 300)
       win = stdwin.open('Sound-o-gram')
       G.sogram = Soundogram().define(win, G.data)
       win.buttons = [G.sogram]
       self.settext(savetext)
Exemplo n.º 19
0
def main():
    player = cd.open()
    stdwin.setdefscrollbars(0, 0)
    win = stdwin.open('CD')
    win.player = player
    win.dispatch = cddispatch
    mainloop.register(win)
    win.settimer(10)
    mainloop.mainloop()
Exemplo n.º 20
0
def show_hook(self):
	savetext = self.text
	self.settext('Be patient...')
	close_sogram()
	stdwin.setdefwinsize(400, 300)
	win = stdwin.open('Sound-o-gram')
	G.sogram = Soundogram().define(win, G.data)
	win.buttons = [G.sogram]
	self.settext(savetext)
Exemplo n.º 21
0
 def open(self, title):
     stdwin.setfont("7x14")
     self.charwidth = stdwin.textwidth("m")
     self.lineheight = stdwin.lineheight()
     self.docwidth = self.width * self.charwidth
     self.docheight = self.height * self.lineheight
     stdwin.setdefwinsize(self.docwidth + 2, self.docheight + 2)
     stdwin.setdefscrollbars(0, 0)
     self.window = stdwin.open(title)
     self.window.setdocsize(self.docwidth + 2, self.docheight + 2)
Exemplo n.º 22
0
 def open(self, title):
     stdwin.setfont('7x14')
     self.charwidth = stdwin.textwidth('m')
     self.lineheight = stdwin.lineheight()
     self.docwidth = self.width * self.charwidth
     self.docheight = self.height * self.lineheight
     stdwin.setdefwinsize(self.docwidth + 2, self.docheight + 2)
     stdwin.setdefscrollbars(0, 0)
     self.window = stdwin.open(title)
     self.window.setdocsize(self.docwidth + 2, self.docheight + 2)
Exemplo n.º 23
0
def test():
	import stdwin, stdwinq
	from stdwinevents import *
	try:
		import mac
		# Mac font assignments:
		font1 = 'times', '', 12
		font2 = 'times', 'b', 14
	except ImportError:
		# X11R4 font assignments
		font1 = '*times-medium-r-*-120-*'
		font2 = '*times-bold-r-*-140-*'
	words = \
	    ['The','quick','brown','fox','jumps','over','the','lazy','dog.']
	words = words * 2
	stage = 0
	stages = [(0,0,'ragged'), (1,0,'justified'), (0,1,'centered')]
	justify, center, title = stages[stage]
	stdwin.setdefwinsize(300,200)
	w = stdwin.open(title)
	winsize = w.getwinsize()
	while 1:
		type, window, detail = stdwinq.getevent()
		if type == WE_CLOSE:
			break
		elif type == WE_SIZE:
			newsize = w.getwinsize()
			if newsize <> winsize:
				w.change((0,0), winsize)
				winsize = newsize
				w.change((0,0), winsize)
		elif type == WE_MOUSE_DOWN:
			stage = (stage + 1) % len(stages)
			justify, center, title = stages[stage]
			w.settitle(title)
			w.change((0, 0), (1000, 1000))
		elif type == WE_DRAW:
			width, height = winsize
			f = formatter(w.begindrawing(), 0, 0, width)
			f.center = center
			f.justify = justify
			if not center:
				f.tempindent(5)
			for font in font1, font2, font1:
				f.setfont(font)
				for word in words:
					space = 1 + (word[-1:] == '.')
					f.addword(word, space)
					if center and space > 1:
						f.flush()
			f.flush()
			height = f.v
			del f
			w.setdocsize(0, height)
Exemplo n.º 24
0
def makewindow():
    stdwin.setdefwinsize(DEFWIDTH, DEFHEIGHT + stdwin.lineheight())
    win = stdwin.open("clock")
    setdimensions(win)
    win.set = 1  # True when alarm is set
    win.time = 11 * 60 + 40  # Time when alarm must go off
    win.ring = 0  # True when alarm is ringing
    win.dispatch = cdispatch
    mainloop.register(win)
    settimer(win)
    return win
Exemplo n.º 25
0
def makewindow():
	stdwin.setdefwinsize(DEFWIDTH, DEFHEIGHT + stdwin.lineheight())
	win = stdwin.open('clock')
	setdimensions(win)
	win.set = 1		# True when alarm is set
	win.time = 11*60 + 40	# Time when alarm must go off
	win.ring = 0		# True when alarm is ringing
	win.dispatch = cdispatch
	mainloop.register(win)
	settimer(win)
	return win
Exemplo n.º 26
0
def test():
    import stdwin, stdwinq
    from stdwinevents import *
    try:
        import mac
        # Mac font assignments:
        font1 = 'times', '', 12
        font2 = 'times', 'b', 14
    except ImportError:
        # X11R4 font assignments
        font1 = '*times-medium-r-*-120-*'
        font2 = '*times-bold-r-*-140-*'
    words = \
        ['The','quick','brown','fox','jumps','over','the','lazy','dog.']
    words = words * 2
    stage = 0
    stages = [(0, 0, 'ragged'), (1, 0, 'justified'), (0, 1, 'centered')]
    justify, center, title = stages[stage]
    stdwin.setdefwinsize(300, 200)
    w = stdwin.open(title)
    winsize = w.getwinsize()
    while 1:
        type, window, detail = stdwinq.getevent()
        if type == WE_CLOSE:
            break
        elif type == WE_SIZE:
            newsize = w.getwinsize()
            if newsize <> winsize:
                w.change((0, 0), winsize)
                winsize = newsize
                w.change((0, 0), winsize)
        elif type == WE_MOUSE_DOWN:
            stage = (stage + 1) % len(stages)
            justify, center, title = stages[stage]
            w.settitle(title)
            w.change((0, 0), (1000, 1000))
        elif type == WE_DRAW:
            width, height = winsize
            f = formatter(w.begindrawing(), 0, 0, width)
            f.center = center
            f.justify = justify
            if not center:
                f.tempindent(5)
            for font in font1, font2, font1:
                f.setfont(font)
                for word in words:
                    space = 1 + (word[-1:] == '.')
                    f.addword(word, space)
                    if center and space > 1:
                        f.flush()
            f.flush()
            height = f.v
            del f
            w.setdocsize(0, height)
Exemplo n.º 27
0
def realmain():
       setdimensions(DEFWIDTH, DEFHEIGHT)
       stdwin.setdefwinsize(G.farcorner)
       G.w = stdwin.open('klok')
       settimer()
       while 1:
               type, window, detail = stdwin.getevent()
               if type = WE_DRAW:
                       drawproc(detail)
               elif type = WE_TIMER:
                       settimer()
                       drawproc(everywhere)
Exemplo n.º 28
0
def open_window(filename, title, contents):
	try:
		window = stdwin.open(title)
	except RuntimeError:
		stdwin.message('cannot open new window')
		return			# Error, forget it
	window.textobject = window.textcreate((0, 0), window.getwinsize())
	window.textobject.settext(contents)
	window.changed = 0
	window.filename = filename
	fix_textsize(window)
	windows.append(window)
Exemplo n.º 29
0
def makewindow(file, ref):
    win = stdwin.open('Info file Browser, by Guido van Rossum')
    win.mainmenu = makemainmenu(win)
    win.navimenu = makenavimenu(win)
    win.textobj = win.textcreate((0, 0), win.getwinsize())
    win.file = file
    win.node = ''
    win.last = []
    win.pat = ''
    win.dispatch = idispatch
    win.nodemenu = None
    win.footmenu = None
    windows.append(win)
    imove(win, ref)
Exemplo n.º 30
0
def main():
    global ok
    digits_seen = 0
    thread.start_new_thread(worker, ())
    tw = stdwin.textwidth('0 ')
    lh = stdwin.lineheight()
    stdwin.setdefwinsize(20 * tw, 20 * lh)
    stdwin.setdefscrollbars(0, 1)
    win = stdwin.open('digits of pi')
    options = win.menucreate('Options')
    options.additem('Auto scroll')
    autoscroll = 1
    options.check(0, autoscroll)
    while 1:
        win.settimer(1)
        type, w, detail = stdwin.getevent()
        if type == WE_CLOSE:
            ok = 0
            sys.exit(0)
        elif type == WE_DRAW:
            (left, top), (right, bottom) = detail
            digits_seen = len(digits)
            d = win.begindrawing()
            for i in range(digits_seen):
                h = (i % 20) * tw
                v = (i / 20) * lh
                if top - lh < v < bottom:
                    d.text((h, v), digits[i])
            d.close()
        elif type == WE_TIMER:
            n = len(digits)
            if n > digits_seen:
                win.settitle( ` n ` + ' digits of pi')
                d = win.begindrawing()
                for i in range(digits_seen, n):
                    h = (i % 20) * tw
                    v = (i / 20) * lh
                    d.text((h, v), digits[i])
                d.close()
                digits_seen = n
                height = (v + 20 * lh) / (20 * lh) * (20 * lh)
                win.setdocsize(0, height)
                if autoscroll:
                    win.show((0, v), (h + tw, v + lh))
        elif type == WE_MENU:
            menu, item = detail
            if menu == options:
                if item == 0:
                    autoscroll = (not autoscroll)
                    options.check(0, autoscroll)
Exemplo n.º 31
0
def makewindow(file, ref):
	win = stdwin.open('Info file Browser, by Guido van Rossum')
	win.mainmenu = makemainmenu(win)
	win.navimenu = makenavimenu(win)
	win.textobj = win.textcreate((0, 0), win.getwinsize())
	win.file = file
	win.node = ''
	win.last = []
	win.pat = ''
	win.dispatch = idispatch
	win.nodemenu = None
	win.footmenu = None
	windows.append(win)
	imove(win, ref)
Exemplo n.º 32
0
def main():
	global ok
	digits_seen = 0
	thread.start_new_thread(worker, ())
	tw = stdwin.textwidth('0 ')
	lh = stdwin.lineheight()
	stdwin.setdefwinsize(20 * tw, 20 * lh)
	stdwin.setdefscrollbars(0, 1)
	win = stdwin.open('digits of pi')
	options = win.menucreate('Options')
	options.additem('Auto scroll')
	autoscroll = 1
	options.check(0, autoscroll)
	while 1:
		win.settimer(1)
		type, w, detail = stdwin.getevent()
		if type == WE_CLOSE:
			ok = 0
			sys.exit(0)
		elif type == WE_DRAW:
			(left, top), (right, bottom) = detail
			digits_seen = len(digits)
			d = win.begindrawing()
			for i in range(digits_seen):
				h = (i % 20) * tw
				v = (i / 20) * lh
				if top-lh < v < bottom:
					d.text((h, v), digits[i])
			d.close()
		elif type == WE_TIMER:
			n = len(digits)
			if n > digits_seen:
				win.settitle(`n` + ' digits of pi')
				d = win.begindrawing()
				for i in range(digits_seen, n):
					h = (i % 20) * tw
					v = (i / 20) * lh
					d.text((h, v), digits[i])
				d.close()
				digits_seen = n
				height = (v + 20*lh) / (20*lh) * (20*lh)
				win.setdocsize(0, height)
				if autoscroll:
					win.show((0, v), (h+tw, v+lh))
		elif type == WE_MENU:
			menu, item = detail
			if menu == options:
				if item == 0:
					autoscroll = (not autoscroll)
					options.check(0, autoscroll)
Exemplo n.º 33
0
 def realize(self):
         if self.win:
                 raise Error, 'realize(): called twice'
         if not self.child:
                 raise Error, 'realize(): no child'
         size = self.child.minsize(self.beginmeasuring())
         self.size = max(self.size[0], size[0]), \
                                         max(self.size[1], size[1])
         #stdwin.setdefwinsize(self.size)
         # XXX Compensate stdwin bug:
         stdwin.setdefwinsize(self.size[0]+4, self.size[1]+2)
         self.win = stdwin.open(self.title)
         if self.itimer:
                 self.win.settimer(self.itimer)
         bounds = (0, 0), self.win.getwinsize()
         self.child.setbounds(bounds)
Exemplo n.º 34
0
def wtest():
    fp = openfile()
    w = stdwin.open('wtest')
    while 1:
        type, win, detail = stdwin.getevent()
        if type == WE_CLOSE:
            break
        if type == WE_DRAW:
            TSTART()
            left, top = 0, 0
            right, bottom = w.getwinsize()
            d = w.begindrawing()
            fmt = StdwinFormatter().init(d, left, top, right)
            fp.seek(0)
            feedfile(fp, fmt)
            d.close()
            TSTOP()
    w.close()
Exemplo n.º 35
0
def wtest():
	fp = openfile()
	w = stdwin.open('wtest')
	while 1:
		type, win, detail = stdwin.getevent()
		if type == WE_CLOSE:
			break
		if type == WE_DRAW:
			TSTART()
			left, top = 0, 0
			right, bottom = w.getwinsize()
			d = w.begindrawing()
			fmt = StdwinFormatter().init(d, left, top, right)
			fp.seek(0)
			feedfile(fp, fmt)
			d.close()
			TSTOP()
	w.close()
Exemplo n.º 36
0
	def open(self):
		if self.window: return
		self.formwidth = max(100, self.formwidth)
		self.formheight = max(50, self.formheight)
		stdwin.setdefwinsize(self.formwidth, self.formheight)
		stdwin.setdefscrollbars(0, 0)
		self.window = stdwin.open(self.title)
		self.window.setdocsize(self.formwidth, self.formheight)
		for name in self.fieldnames:
			label, left, top, right, bottom, te = \
				  self.fields[name]
			rect = (left, top), (right, bottom)
			te = self.window.textcreate(rect)
			te.setactive(0)
			te.setview(rect)
			self.fields[name] = \
				  label, left, top, right, bottom, te
		if self.fieldnames:
			self.setfocus(self.fieldnames[0])
Exemplo n.º 37
0
def makewindow():
    # stdwin.setdefscrollbars(0, 1) # Not in Python 0.9.1
    # stdwin.setfont('monaco') # Not on UNIX! and not Python 0.9.1
    # width, height = stdwin.textwidth('in')*40, stdwin.lineheight()*24
    # stdwin.setdefwinsize(width, height)
    win = stdwin.open('Python interpreter ready')
    win.editor = win.textcreate((0, 0), win.getwinsize())
    win.globals = {}  # Dictionary for user's globals
    win.command = ''  # Partially read command
    win.busy = 0  # Ready to accept a command
    win.auto = 1  # [CR] executes command
    win.insertOutput = 1  # Insert output at focus
    win.insertError = 1  # Insert error output at focus
    win.setwincursor('ibeam')
    win.filename = ''  # Empty if no file for this window
    makefilemenu(win)
    makeeditmenu(win)
    win.dispatch = pdispatch  # Event dispatch function
    mainloop.register(win)
    return win
Exemplo n.º 38
0
def makewindow():
	# stdwin.setdefscrollbars(0, 1) # Not in Python 0.9.1
	# stdwin.setfont('monaco') # Not on UNIX! and not Python 0.9.1
	# width, height = stdwin.textwidth('in')*40, stdwin.lineheight()*24
	# stdwin.setdefwinsize(width, height)
	win = stdwin.open('Python interpreter ready')
	win.editor = win.textcreate((0,0), win.getwinsize())
	win.globals = {}		# Dictionary for user's globals
	win.command = ''		# Partially read command
	win.busy = 0			# Ready to accept a command
	win.auto = 1			# [CR] executes command
	win.insertOutput = 1		# Insert output at focus
	win.insertError = 1		# Insert error output at focus
	win.setwincursor('ibeam')
	win.filename = ''		# Empty if no file for this window
	makefilemenu(win)
	makeeditmenu(win)
	win.dispatch = pdispatch	# Event dispatch function
	mainloop.register(win)
	return win
Exemplo n.º 39
0
def main():
	delay = DEF_DELAY
	#
	try:
		thisuser = posix.environ['LOGNAME']
	except:
		thisuser = posix.environ['USER']
	#
	printers = sys.argv[1:]
	if printers:
		# Strip '-P' from printer names just in case
		# the user specified it...
		for i in range(len(printers)):
			if printers[i][:2] == '-P':
				printers[i] = printers[i][2:]
	else:
		if posix.environ.has_key('PRINTER'):
			printers = [posix.environ['PRINTER']]
		else:
			printers = [DEF_PRINTER]
	#
	width = stdwin.textwidth('in')*20
	height = len(printers) * stdwin.lineheight() + 5
	stdwin.setdefwinsize(width, height)
	stdwin.setdefscrollbars(0, 0)
	#
	win = stdwin.open('lpwin')
	#
	win.printers = printers
	win.colors = [c_unknown] * len(printers)
	win.texts = printers[:]
	win.next = 0
	win.delay = DEF_DELAY
	win.thisuser = thisuser
	win.dispatch = lpdispatch
	#
	win.settimer(1)
	#
	mainloop.register(win)
	mainloop.mainloop()
Exemplo n.º 40
0
def wwwtest():
    fp = openfile()
    TSTART()
    calls = makecalls(fp, StdwinFormatter)
    TSTOP()
    w = stdwin.open('wwwtest')
    TSTART()
    left, top = 0, 0
    right, bottom = w.getwinsize()
    fmt = BufferingStdwinFormatter().init(left, top, right)
    feedcalls(calls, fmt)
    bottom = fmt.getbottom()
    w.setdocsize(0, bottom)
    TSTOP()
    ##	for x in fmt.buffer: print x
    while 1:
        type, win, detail = stdwin.getevent()
        if type == WE_CLOSE:
            break
        if type == WE_SIZE:
            width, height = w.getwinsize()
            if width <> right:
                TSTART()
                left, top = 0, 0
                right, bottom = w.getwinsize()
                fmt = BufferingStdwinFormatter(). \
                 init(left, top, right)
                feedcalls(calls, fmt)
                bottom = fmt.getbottom()
                w.setdocsize(0, bottom)
                TSTOP()
        if type == WE_DRAW:
            TSTART()
            d = w.begindrawing()
            fmt.render(d, detail)
            d.close()
            TSTOP()
    w.close()
Exemplo n.º 41
0
def wwwtest():
	fp = openfile()
	TSTART()
	calls = makecalls(fp, StdwinFormatter)
	TSTOP()
	w = stdwin.open('wwwtest')
	TSTART()
	left, top = 0, 0
	right, bottom = w.getwinsize()
	fmt = BufferingStdwinFormatter().init(left, top, right)
	feedcalls(calls, fmt)
	bottom = fmt.getbottom()
	w.setdocsize(0, bottom)
	TSTOP()
##	for x in fmt.buffer: print x
	while 1:
		type, win, detail = stdwin.getevent()
		if type == WE_CLOSE:
			break
		if type == WE_SIZE:
			width, height = w.getwinsize()
			if width <> right:
				TSTART()
				left, top = 0, 0
				right, bottom = w.getwinsize()
				fmt = BufferingStdwinFormatter(). \
					init(left, top, right)
				feedcalls(calls, fmt)
				bottom = fmt.getbottom()
				w.setdocsize(0, bottom)
				TSTOP()
		if type == WE_DRAW:
			TSTART()
			d = w.begindrawing()
			fmt.render(d, detail)
			d.close()
			TSTOP()
	w.close()
Exemplo n.º 42
0
def openlistwindow(dirname):
	list = os.listdir(dirname)
	list.sort()
	i = 0
	while i < len(list):
		if list[i][0] == '.':
			del list[i]
		else:
			i = i+1
	for i in range(len(list)):
		fullname = os.path.join(dirname, list[i])
		if os.path.isdir(fullname):
			info = '/'
		else:
			try:
				size = os.stat(fullname)[ST_SIZE]
				info = `(size + 1023)/1024` + 'k'
			except IOError:
				info = '???'
			info = '(' + info + ')'
		list[i] = list[i], info
	width = maxwidth(list)
	# width = width + stdwin.textwidth(' ')	# XXX X11 stdwin bug workaround
	height = len(list) * stdwin.lineheight()
	stdwin.setdefwinsize(width, min(height, 500))
	stdwin.setdefscrollbars(0, 1)
	w = stdwin.open(dirname)
	stdwin.setdefwinsize(0, 0)
	w.setdocsize(width, height)
	w.drawproc = drawlistwindow
	w.mouse = mouselistwindow
	w.close = closelistwindow
	w.dirname = dirname
	w.list = list
	w.selected = -1
	return w
Exemplo n.º 43
0
def openlistwindow(dirname):
    list = os.listdir(dirname)
    list.sort()
    i = 0
    while i < len(list):
        if list[i][0] == '.':
            del list[i]
        else:
            i = i + 1
    for i in range(len(list)):
        fullname = os.path.join(dirname, list[i])
        if os.path.isdir(fullname):
            info = '/'
        else:
            try:
                size = os.stat(fullname)[ST_SIZE]
                info = ` (size + 1023) / 1024 ` + 'k'
            except IOError:
                info = '???'
            info = '(' + info + ')'
        list[i] = list[i], info
    width = maxwidth(list)
    # width = width + stdwin.textwidth(' ')	# XXX X11 stdwin bug workaround
    height = len(list) * stdwin.lineheight()
    stdwin.setdefwinsize(width, min(height, 500))
    stdwin.setdefscrollbars(0, 1)
    w = stdwin.open(dirname)
    stdwin.setdefwinsize(0, 0)
    w.setdocsize(width, height)
    w.drawproc = drawlistwindow
    w.mouse = mouselistwindow
    w.close = closelistwindow
    w.dirname = dirname
    w.list = list
    w.selected = -1
    return w
Exemplo n.º 44
0
def main():
    #
    # Get the filename argument and read its contents as one very
    # large string.
    # An exception will terminate the program if there is no argument
    # or if the file could not be read...
    #
    filename = sys.argv[1]
    fp = open(filename, 'r')
    contents = fp.read()
    del fp  # Close the file
    #
    # Create the window, using the filename as window title
    #
    window = stdwin.open(filename)
    #
    # Add a simple File menu to the window with two items
    #
    filemenu = window.menucreate('File')
    filemenu.additem('Save', 'S')  # Item 0 (shortcut Meta-S)
    filemenu.additem('Save As...')  # Item 1
    #
    # Create a text object occupying the entire window
    # and fill it with the file's contents
    #
    corner = window.getwinsize()  # (width, height)
    area = (0, 0), corner  # Rectangle as large as the window
    text = window.textcreate(area)
    text.settext(contents)
    del contents  # Get rid of contents object
    fix_textsize(window, text)  # Set document size accordingly
    #
    # Main event loop -- stop if a close request comes in.
    #
    # STDWIN applications should regularly call stdwin.getevent()
    # otherwise the windows won't function as expected.
    #
    while 1:
        #
        # Get the next event
        #
        type, w, detail = e = stdwin.getevent()
        #
        # Event decoding switch
        #
        if type == WE_CLOSE:
            break  # Stop (no check for saved file!)
        elif type == WE_SIZE:
            #
            # The window was resized --
            # let the text object recompute the line breaks
            # and change the document size accordingly,
            # so scroll bars will work
            #
            fix_textsize(window, text)
        elif type == WE_MENU:
            #
            # Execute a file menu request (our only menu)
            #
            menu, item = detail
            if item == 0:
                #
                # "Save": save to the current filename
                #
                dummy = save_file(window, text, filename)
            elif item == 1:
                #
                # "Save As": ask a new filename, save to it,
                # and make it the current filename
                #
                # NB: askfile raises KeyboardInterrupt
                # if the user cancels the dialog, hence
                # the try statement
                #
                try:
                    newfile = stdwin.askfile( \
                     'Save as:', filename, 1)
                except KeyboardInterrupt:
                    newfile = ''
                if newfile:
                    if save_file(window, text, newfile):
                        filename = newfile
                        window.settitle(filename)
        elif text.event(e):
            #
            # The text object has handled the event.
            # Fix the document size if necessary.
            # Note: this sometimes fixes the size
            # unnecessarily, e.g., for arrow keys.
            #
            if type in (WE_CHAR, WE_COMMAND):
                fix_docsize(window, text)
Exemplo n.º 45
0
def main():
	#
	# Get the filename argument and read its contents as one very
	# large string.
	# An exception will terminate the program if there is no argument
	# or if the file could not be read...
	#
	filename = sys.argv[1]
	fp = open(filename, 'r')
	contents = fp.read()
	del fp				# Close the file
	#
	# Create the window, using the filename as window title
	#
	window = stdwin.open(filename)
	#
	# Add a simple File menu to the window with two items
	#
	filemenu = window.menucreate('File')
	filemenu.additem('Save', 'S')	# Item 0 (shortcut Meta-S)
	filemenu.additem('Save As...')	# Item 1
	#
	# Create a text object occupying the entire window
	# and fill it with the file's contents
	#
	corner = window.getwinsize()	# (width, height)
	area = (0, 0), corner		# Rectangle as large as the window
	text = window.textcreate(area)
	text.settext(contents)
	del contents			# Get rid of contents object
	fix_textsize(window, text)	# Set document size accordingly
	#
	# Main event loop -- stop if a close request comes in.
	#
	# STDWIN applications should regularly call stdwin.getevent()
	# otherwise the windows won't function as expected.
	#
	while 1:
		#
		# Get the next event
		#
		type, w, detail = e = stdwin.getevent()
		#
		# Event decoding switch
		#
		if type == WE_CLOSE:
			break		# Stop (no check for saved file!)
		elif type == WE_SIZE:
			#
			# The window was resized --
			# let the text object recompute the line breaks
			# and change the document size accordingly,
			# so scroll bars will work
			#
			fix_textsize(window, text)
		elif type == WE_MENU:
			#
			# Execute a file menu request (our only menu)
			#
			menu, item = detail
			if item == 0:
				#
				# "Save": save to the current filename
				#
				dummy = save_file(window, text, filename)
			elif item == 1:
				#
				# "Save As": ask a new filename, save to it,
				# and make it the current filename
				#
				# NB: askfile raises KeyboardInterrupt
				# if the user cancels the dialog, hence
				# the try statement
				#
				try:
					newfile = stdwin.askfile( \
						'Save as:', filename, 1)
				except KeyboardInterrupt:
					newfile = ''
				if newfile:
					if save_file(window, text, newfile):
						filename = newfile
						window.settitle(filename)
		elif text.event(e):
			#
			# The text object has handled the event.
			# Fix the document size if necessary.
			# Note: this sometimes fixes the size
			# unnecessarily, e.g., for arrow keys.
			#
			if type in (WE_CHAR, WE_COMMAND):
				fix_docsize(window, text)
Exemplo n.º 46
0
def test():
	import stdwin
	from stdwinevents import *
	words = 'The', 'quick', 'brown', 'fox', 'jumps', 'over', \
		'the', 'lazy', 'dog.'
	paralist = []
	for just in 'l', 'r', 'lr', 'c':
		p = Para()
		p.just = just
		p.addword(stdwin, ('New York', 'p', 12), words[0], 1, 1)
		for word in words[1:-1]:
			p.addword(stdwin, None, word, 1, 1)
		p.addword(stdwin, None, words[-1], 2, 4)
		p.addword(stdwin, ('New York', 'b', 18), 'Bye!', 0, 0)
		p.addword(stdwin, ('New York', 'p', 10), 'Bye!', 0, 0)
		paralist.append(p)
	window = stdwin.open('Para.test()')
	start = stop = selpara = None
	while 1:
		etype, win, detail = stdwin.getevent()
		if etype == WE_CLOSE:
			break
		if etype == WE_SIZE:
			window.change((0, 0), (1000, 1000))
		if etype == WE_DRAW:
			width, height = window.getwinsize()
			d = None
			try:
				d = window.begindrawing()
				d.cliprect(detail)
				d.erase(detail)
				v = 0
				for p in paralist:
					v = p.render(d, 0, v, width)
					if p == selpara and \
					   start <> None and stop <> None:
						p.invert(d, start, stop)
			finally:
				if d: d.close()
		if etype == WE_MOUSE_DOWN:
			if selpara and start <> None and stop <> None:
				d = window.begindrawing()
				selpara.invert(d, start, stop)
				d.close()
			start = stop = selpara = None
			mouseh, mousev = detail[0]
			for p in paralist:
				start = p.whereis(stdwin, mouseh, mousev)
				if start <> None:
					selpara = p
					break
		if etype == WE_MOUSE_UP and start <> None and selpara:
			mouseh, mousev = detail[0]
			stop = selpara.whereis(stdwin, mouseh, mousev)
			if stop == None: start = selpara = None
			else:
				if start > stop:
					start, stop = stop, start
				d = window.begindrawing()
				selpara.invert(d, start, stop)
				d.close()
	window.close()
Exemplo n.º 47
0
 def init(self, title):
     self.window = stdwin.open(title)
     self.window.dispatch = self.dispatch
     register(self.window)
     return self
Exemplo n.º 48
0
 def __init__(self, title):
     self.window = stdwin.open(title)
     self.window.dispatch = self.dispatch
     register(self.window)
Exemplo n.º 49
0
	def init(self, title):
		self.window = stdwin.open(title)
		self.window.dispatch = self.dispatch
		register(self.window)
		return self
Exemplo n.º 50
0
def test():
	import stdwin
	from stdwinevents import *
	words = 'The', 'quick', 'brown', 'fox', 'jumps', 'over', \
		'the', 'lazy', 'dog.'
	paralist = []
	for just in 'l', 'r', 'lr', 'c':
		p = Para()
		p.just = just
		p.addword(stdwin, ('New York', 'p', 12), words[0], 1, 1)
		for word in words[1:-1]:
			p.addword(stdwin, None, word, 1, 1)
		p.addword(stdwin, None, words[-1], 2, 4)
		p.addword(stdwin, ('New York', 'b', 18), 'Bye!', 0, 0)
		p.addword(stdwin, ('New York', 'p', 10), 'Bye!', 0, 0)
		paralist.append(p)
	window = stdwin.open('Para.test()')
	start = stop = selpara = None
	while 1:
		etype, win, detail = stdwin.getevent()
		if etype == WE_CLOSE:
			break
		if etype == WE_SIZE:
			window.change((0, 0), (1000, 1000))
		if etype == WE_DRAW:
			width, height = window.getwinsize()
			d = None
			try:
				d = window.begindrawing()
				d.cliprect(detail)
				d.erase(detail)
				v = 0
				for p in paralist:
					v = p.render(d, 0, v, width)
					if p == selpara and \
					   start <> None and stop <> None:
						p.invert(d, start, stop)
			finally:
				if d: d.close()
		if etype == WE_MOUSE_DOWN:
			if selpara and start <> None and stop <> None:
				d = window.begindrawing()
				selpara.invert(d, start, stop)
				d.close()
			start = stop = selpara = None
			mouseh, mousev = detail[0]
			for p in paralist:
				start = p.whereis(stdwin, mouseh, mousev)
				if start <> None:
					selpara = p
					break
		if etype == WE_MOUSE_UP and start <> None and selpara:
			mouseh, mousev = detail[0]
			stop = selpara.whereis(stdwin, mouseh, mousev)
			if stop == None: start = selpara = None
			else:
				if start > stop:
					start, stop = stop, start
				d = window.begindrawing()
				selpara.invert(d, start, stop)
				d.close()
	window.close()
Exemplo n.º 51
0
	list.sort()
	i = 0
	while i < len(list):
		if list[i] = '.' or list[i] = '..':
			del list[i]
		else:
			i = i+1
	for i in range(len(list)):
		name = list[i]
		if path.isdir(path.cat(dirname, name)):
			list[i] = list[i] + '/'
	width = maxwidth(list)
	width = width + stdwin.textwidth(' ')	# XXX X11 stdwin bug workaround
	height = len(list) * stdwin.lineheight()
	stdwin.setdefwinsize(width, min(height, 500))
	w = stdwin.open(dirname)
	stdwin.setdefwinsize(0, 0)
	w.setdocsize(width, height)
	w.drawproc = drawlistwindow
	w.mouse = mouselistwindow
	w.close = closelistwindow
	w.dirname = dirname
	w.list = list
	w.selected = -1
	return w

def maxwidth(list):
	width = 1
	for name in list:
		w = stdwin.textwidth(name)
		if w > width: width = w
Exemplo n.º 52
0
       list.sort()
       i = 0
       while i < len(list):
               if list[i] = '.' or list[i] = '..':
                       del list[i]
               else:
                       i = i+1
       for i in range(len(list)):
               name = list[i]
               if path.isdir(path.cat(dirname, name)):
                       list[i] = list[i] + '/'
       width = maxwidth(list)
       width = width + stdwin.textwidth(' ')   # XXX X11 stdwin bug workaround
       height = len(list) * stdwin.lineheight()
       stdwin.setdefwinsize(width, min(height, 500))
       w = stdwin.open(dirname)
       stdwin.setdefwinsize(0, 0)
       w.setdocsize(width, height)
       w.drawproc = drawlistwindow
       w.mouse = mouselistwindow
       w.close = closelistwindow
       w.dirname = dirname
       w.list = list
       w.selected = -1
       return w

def maxwidth(list):
       width = 1
       for name in list:
               w = stdwin.textwidth(name)
               if w > width: width = w
Exemplo n.º 53
0
	def __init__(self, title):
		self.window = stdwin.open(title)
		self.window.dispatch = self.dispatch
		register(self.window)
Exemplo n.º 54
0
# Pass this program the Holy Grail script on stdin.
Exemplo n.º 55
0
	def __init__(self, title):
		self.win = stdwin.open(title)
		self.win.dispatch = self.dispatch
		mainloop.register(self.win)