GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/simplegui_01.py at master · kudou/Python Expand file tree/ Copy pathsimplegui_01.pyMore file actions 56 lines (43 loc) · 1.06 KB / Copy pathsimplegui_01.pyFile metadata and controls56 lines (43 loc) · 1.06 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 # Starting point for calculator import simplegui # Initialize globals store = 0 operand = 0 # Define functions that manipulate store and operand def output(): print "Store = ", store print "Operand = ", operand print "" def swap(): global store, operand store, operand = operand, store output() def add(): global store, operand store = store + operand output() def sub(): global store, operand store = store - operand output() def multiply(): global store, operand store = store * operand output() def div(): global store, operand store = float(store) / operand output() def enter(inp): global operand operand = float(inp) output() frame = simplegui.create_frame("Caculator", 200, 500) frame.add_button("Print", output, 100) frame.add_button("Swap", swap, 100) frame.add_button("Add", add, 100) frame.add_button("Sub", sub, 100) frame.add_button("Mul", multiply, 100) frame.add_button("Div", div, 100) frame.add_input("Enter operand", enter, 100) frame.start() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |