コード例 #1
0
def main():
	from TextEdit import TextEdit
	from WindowParent import WindowParent, MainLoop
	w = WindowParent().create('Test TextEdit', (0, 0))
	t = TextEdit().create(w, (40, 4))
	w.realize()
	MainLoop()
コード例 #2
0
def main():
    from TextEdit import TextEdit
    from WindowParent import WindowParent, MainLoop
    w = WindowParent().create('Test TextEdit', (0, 0))
    t = TextEdit().create(w, (40, 4))
    w.realize()
    MainLoop()
コード例 #3
0
ファイル: vumeter.py プロジェクト: asottile/ancient-pythons
def main():
	audio.setrate(3)
	audio.setoutgain(0)
	w = WindowParent().create('VU Meter', (200, 100))
	v = MyVUMeter().define(w)
	v.start()
	w.realize()
	while 1:
		w.dispatch(stdwin.getevent())
コード例 #4
0
ファイル: vumeter.py プロジェクト: tomjackbear/python-0.9.1
def main():
       audio.setrate(3)
       audio.setoutgain(0)
       w = WindowParent().create('VU Meter', (200, 100))
       v = MyVUMeter().define(w)
       v.start()
       w.realize()
       while 1:
               w.dispatch(stdwin.getevent())
コード例 #5
0
def opencontrolwindow():
	cw = WindowParent().create('Jukebox', (0, 0))
	v = VSplit().create(cw)
	#
	gain = ComplexSlider().define(v)
	gain.setminvalmax(0, G.gain, 255)
	gain.settexts('  ', '  ')
	gain.sethook(gain_setval_hook)
	#
	stop = PushButton().definetext(v, 'Stop')
	stop.hook = stop_hook
	#
	cw.realize()
	return cw
コード例 #6
0
ファイル: jukebox.py プロジェクト: asottile/ancient-pythons
def opencontrolwindow():
	cw = WindowParent().create('Jukebox', (0, 0))
	v = VSplit().create(cw)
	#
	gain = ComplexSlider().define(v)
	gain.setminvalmax(0, G.gain, 255)
	gain.settexts('  ', '  ')
	gain.sethook(gain_setval_hook)
	#
	stop = PushButton().definetext(v, 'Stop')
	stop.hook = stop_hook
	#
	cw.realize()
	return cw
コード例 #7
0
def main(n):
	from CSplit import CSplit
	#
	stdwin.setdefscrollbars(0, 0)
	#
	the_window = WindowParent().create('TestCSplit', (0, 0))
	the_csplit = CSplit().create(the_window)
	#
	for i in range(n):
		the_child = PushButton().define(the_csplit)
		the_child.settext(`(i+n-1)%n+1`)
	#
	the_window.realize()
	#
	MainLoop()
コード例 #8
0
def main(n):
    from CSplit import CSplit
    #
    stdwin.setdefscrollbars(0, 0)
    #
    the_window = WindowParent().create('TestCSplit', (0, 0))
    the_csplit = CSplit().create(the_window)
    #
    for i in range(n):
        the_child = PushButton().define(the_csplit)
        the_child.settext( ` (i + n - 1) % n + 1 `)
    #
    the_window.realize()
    #
    MainLoop()
コード例 #9
0
def main(n):
	from CSplit import CSplit
	
	window = WindowParent().create('TestSched', (0, 0))
	csplit = CSplit().create(window)
	
	for i in range(n):
		child = PushButton().define(csplit)
		child.my_number = i
		child.my_id = None
		child.settext(`(i+n-1)%n+1`)
		child.hook = my_hook
	
	window.realize()
	
	WindowSched.run()
コード例 #10
0
def main(n):
	from FormSplit import FormSplit
	#
	stdwin.setdefscrollbars(1, 1)
	#
	the_window = WindowParent().create('TestFormSplit', (0, 0))
	the_form = FormSplit().create(the_window)
	#
	for i in range(n):
		if i % 3 == 0:
			the_form.placenext(i*40, 0)
		the_child = PushButton().define(the_form)
		the_child.settext('XXX-' + `i` + '-YYY')
	#
	the_window.realize()
	#
	MainLoop()
コード例 #11
0
def main(n):
    from FormSplit import FormSplit
    #
    stdwin.setdefscrollbars(1, 1)
    #
    the_window = WindowParent().create('TestFormSplit', (0, 0))
    the_form = FormSplit().create(the_window)
    #
    for i in range(n):
        if i % 3 == 0:
            the_form.placenext(i * 40, 0)
        the_child = PushButton().define(the_form)
        the_child.settext('XXX-' + ` i ` + '-YYY')
    #
    the_window.realize()
    #
    MainLoop()
コード例 #12
0
ファイル: TestCSplit.py プロジェクト: th-rpy/python-0.9.1
def main(n):
	from CSplit import CSplit
	
	the_window = WindowParent().create('TestCSplit', (0, 0))
	the_csplit = CSplit().create(the_window)
	
	for i in range(n):
		the_child = PushButton().define(the_csplit)
		the_child.settext(`(i+n-1)%n+1`)
	
	the_window.realize()
	
	while 1:
		the_event = stdwin.getevent()
		if the_event[0] = WE_CLOSE: break
		the_window.dispatch(the_event)
	the_window.destroy()
コード例 #13
0
def main(n):
       from CSplit import CSplit

       the_window = WindowParent().create('TestCSplit', (0, 0))
       the_csplit = CSplit().create(the_window)

       for i in range(n):
               the_child = PushButton().define(the_csplit)
               the_child.settext(`(i+n-1)%n+1`)

       the_window.realize()

       while 1:
               the_event = stdwin.getevent()
               if the_event[0] = WE_CLOSE: break
               the_window.dispatch(the_event)
       the_window.destroy()
コード例 #14
0
ファイル: jukebox.py プロジェクト: asottile/ancient-pythons
def opencontrolwindow():
	stdwin.setdefscrollbars(0, 0)
	cw = WindowParent().create('Jukebox', (0, 0))
	#
	stop = PushButton().definetext(cw, '        Stop        ')
	stop.hook = stop_hook
	stop.enable(0)
	G.stop = stop
	#
	cw.realize()
	#
	G.ratemenu = cw.win.menucreate('Rate')
	for r in rates:
		G.ratemenu.additem(r)
	if G.rate == 0:
		G.ratemenu.check(0, 1)
	else:
		for i in len(range(rates)):
			if rates[i] == `G.rate`:
				G.ratemenu.check(i, 1)
	#
	return cw
コード例 #15
0
ファイル: jukebox.py プロジェクト: olympu/ancient-pythons
def opencontrolwindow():
    stdwin.setdefscrollbars(0, 0)
    cw = WindowParent().create('Jukebox', (0, 0))
    #
    stop = PushButton().definetext(cw, '        Stop        ')
    stop.hook = stop_hook
    stop.enable(0)
    G.stop = stop
    #
    cw.realize()
    #
    G.ratemenu = cw.win.menucreate('Rate')
    for r in rates:
        G.ratemenu.additem(r)
    if G.rate == 0:
        G.ratemenu.check(0, 1)
    else:
        for i in len(range(rates)):
            if rates[i] == ` G.rate `:
                G.ratemenu.check(i, 1)
    #
    return cw
コード例 #16
0
def main():
    import stdwin
    from WindowParent import WindowParent, MainLoop
    from FormSplit import FormSplit
    from Buttons import Label
    from TextEdit import TextEdit
    #
    stdwin.setdefscrollbars(0, 0)
    #
    w = WindowParent().create('FormTest', (0, 0))
    f = FormSplit().create(w)
    #
    h, v = 0, 0
    for label in testlabels:
        f.placenext(h, v)
        lbl = Label().definetext(f, label)
        f.placenext(h + 100, v)
        txt = TextEdit().createboxed(f, (40, 2), (2, 2))
        #txt = TextEdit().create(f, (40, 2))
        v = v + 2 * stdwin.lineheight() + 10
    #
    w.realize()
    #
    MainLoop()
コード例 #17
0
ファイル: FormTest.py プロジェクト: asottile/ancient-pythons
def main():
	import stdwin
	from WindowParent import WindowParent, MainLoop
	from FormSplit import FormSplit
	from Buttons import Label
	from TextEdit import TextEdit
	#
	stdwin.setdefscrollbars(0, 0)
	#
	w = WindowParent().create('FormTest', (0, 0))
	f = FormSplit().create(w)
	#
	h, v = 0, 0
	for label in testlabels:
		f.placenext(h, v)
		lbl = Label().definetext(f, label)
		f.placenext(h + 100, v)
		txt = TextEdit().createboxed(f, (40, 2), (2, 2))
		#txt = TextEdit().create(f, (40, 2))
		v = v + 2*stdwin.lineheight() + 10
	#
	w.realize()
	#
	MainLoop()
コード例 #18
0
def main():
    #
    # Create the widget hierarchy, top-down
    #
    # 1. Create the window
    #
    window = WindowParent().create('Radio Groups', (0, 0))
    #
    # 2. Create a horizontal split to contain the groups
    #
    topsplit = HSplit().create(window)
    #
    # 3. Create vertical splits, one for each group
    #
    group1 = VSplit().create(topsplit)
    group2 = VSplit().create(topsplit)
    group3 = VSplit().create(topsplit)
    #
    # 4. Create individual radio buttons, each in their own split
    #
    b11 = RadioButton().definetext(group1, 'Group 1 button 1')
    b12 = RadioButton().definetext(group1, 'Group 1 button 2')
    b13 = RadioButton().definetext(group1, 'Group 1 button 3')
    #
    b21 = RadioButton().definetext(group2, 'Group 2 button 1')
    b22 = RadioButton().definetext(group2, 'Group 2 button 2')
    b23 = RadioButton().definetext(group2, 'Group 2 button 3')
    #
    b31 = RadioButton().definetext(group3, 'Group 3 button 1')
    b32 = RadioButton().definetext(group3, 'Group 3 button 2')
    b33 = RadioButton().definetext(group3, 'Group 3 button 3')
    #
    # 5. Define the grouping for the radio buttons.
    #    Note: this doesn't have to be the same as the
    #    grouping is splits (although it usually is).
    #    Also set the 'hook' procedure for each button
    #
    list1 = [b11, b12, b13]
    list2 = [b21, b22, b23]
    list3 = [b31, b32, b33]
    #
    for b in list1:
        b.group = list1
        b.on_hook = myhook
    for b in list2:
        b.group = list2
        b.on_hook = myhook
    for b in list3:
        b.group = list3
        b.on_hook = myhook
    #
    # 6. Select a default button in each group
    #
    b11.select(1)
    b22.select(1)
    b33.select(1)
    #
    # 6. Realize the window
    #
    window.realize()
    #
    # 7. Dispatch events until the window is closed
    #
    MainLoop()
    #
    # 8. Report final selections
    #
    print 'You selected the following choices:'
    if b11.selected: print '1.1'
    if b12.selected: print '1.2'
    if b13.selected: print '1.3'
    if b21.selected: print '2.1'
    if b22.selected: print '2.2'
    if b23.selected: print '2.3'
    if b31.selected: print '3.1'
    if b32.selected: print '3.2'
    if b33.selected: print '3.3'
コード例 #19
0
def main():
	#
	# Create the widget hierarchy, top-down
	#
	# 1. Create the window
	#
	window = WindowParent().create('Radio Groups', (0, 0))
	#
	# 2. Create a horizontal split to contain the groups
	#
	topsplit = HSplit().create(window)
	#
	# 3. Create vertical splits, one for each group
	#
	group1 = VSplit().create(topsplit)
	group2 = VSplit().create(topsplit)
	group3 = VSplit().create(topsplit)
	#
	# 4. Create individual radio buttons, each in their own split
	#
	b11 = RadioButton().definetext(group1, 'Group 1 button 1')
	b12 = RadioButton().definetext(group1, 'Group 1 button 2')
	b13 = RadioButton().definetext(group1, 'Group 1 button 3')
	#
	b21 = RadioButton().definetext(group2, 'Group 2 button 1')
	b22 = RadioButton().definetext(group2, 'Group 2 button 2')
	b23 = RadioButton().definetext(group2, 'Group 2 button 3')
	#
	b31 = RadioButton().definetext(group3, 'Group 3 button 1')
	b32 = RadioButton().definetext(group3, 'Group 3 button 2')
	b33 = RadioButton().definetext(group3, 'Group 3 button 3')
	#
	# 5. Define the grouping for the radio buttons.
	#    Note: this doesn't have to be the same as the
	#    grouping is splits (although it usually is).
	#    Also set the 'hook' procedure for each button
	#
	list1 = [b11, b12, b13]
	list2 = [b21, b22, b23]
	list3 = [b31, b32, b33]
	#
	for b in list1:
		b.group = list1
		b.on_hook = myhook
	for b in list2:
		b.group = list2
		b.on_hook = myhook
	for b in list3:
		b.group = list3
		b.on_hook = myhook
	#
	# 6. Select a default button in each group
	#
	b11.select(1)
	b22.select(1)
	b33.select(1)
	#
	# 6. Realize the window
	#
	window.realize()
	#
	# 7. Dispatch events until the window is closed
	#
	MainLoop()
	#
	# 8. Report final selections
	#
	print 'You selected the following choices:'
	if b11.selected: print '1.1'
	if b12.selected: print '1.2'
	if b13.selected: print '1.3'
	if b21.selected: print '2.1'
	if b22.selected: print '2.2'
	if b23.selected: print '2.3'
	if b31.selected: print '3.1'
	if b32.selected: print '3.2'
	if b33.selected: print '3.3'