Debian Codegraph @

fltk/test/child_bug.py

raw symbols SCIP
1 from fltk import *
2 #.add() .child() bug example code
3
4 win=Fl_Window(300,200)
5 win.begin()
6
7 win.add(Fl_Input(100, 10, 100, 40,'child 0 .add'))
8 inp=Fl_Input(100, 100, 100, 40,'child 1 inp')
9
10 win.end()
11
12 print(win.children()) #2 indices 0,1
13 print('parent win: ', type(win) , id(win)) #parent
14
15 print('child 0 .add: ', type(win.child(0)), id(win.child(0)))#first input
16 #the next two widgets should be the same but they are not.
17 print('child 1 inp: ', type(win.child(1)), id(win.child(1)))#second input
18 print('Fl_Input inp: ', type(inp) , id(inp)) #second input
19
20 win.child(0).color(FL_YELLOW) #works because .color IS a method of Fl_Widget
21 win.child(1).color(FL_GREEN)
22
23 #win.child(0).value('Hello World') #fails because .value IS NOT a method of Fl_Widget
24 #win.child(1).value('Hello World')
25 inp.value('Bye') #works because .value IS a method of Fl_Input
26
27 print('notice the id of child 0 and child 1 are the same. This seems wrong.')
28 win.show()
29 Fl.run()
30