MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / Adder

Class Adder

27_fltk/python/fltk_ex.py:7–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class Adder(Fl_Widget):
8 def __new__(self):
9 container = Fl_Pack(80, 50, 200, 20, "Adder Widget")
10 button = Fl_Button(0, 0, 50, 20, "add 1")
11 button.callback(self.add1)
12 button2 = Fl_Button(0, 0, 50, 20, "add 2")
13 button2.callback(self.add2)
14 button3 = Fl_Button(0, 0, 80, 20, "subtract 3")
15 button3.callback(self.sub3)
16 container.end()
17 container.type(FL_HORIZONTAL)
18
19 container2 = Fl_Pack(80, 130, 200, 20, "file widget")
20 button4 = Fl_Button(0, 0, 80, 20, "open file")
21 button4.callback(self.open_file)
22 container2.end()
23
24 def add1(self):
25 global COUNTER
26 COUNTER += 1
27 disp_frame.label(str(COUNTER))
28
29 def add2(self):
30 global COUNTER
31 COUNTER += 2
32 disp_frame.label(str(COUNTER))
33
34 def sub3(self):
35 global COUNTER
36 COUNTER -= 3
37 disp_frame.label(str(COUNTER))
38
39 def open_file(self):
40 fc = Fl_File_Chooser(".", "*.rs", Fl_File_Chooser.SINGLE, "Choose File")
41 fc.show()
42 while fc.visible():
43 Fl.wait()
44 self.filename = fc.value(1)
45
46
47class NoEscWindow(Fl_Window):

Callers 1

fltk_ex.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected