Forum » Programiranje » Python - calculator
Python - calculator

ktka ::
Hey...imam program, ki naredi kalkulator. Je iz knjige Python and Tkinter Programming .
Kalkulator je narejen s pomočjo pakata Tkinter. Dodati moram metode za računske operacije. Operacije, ki so predtsvaljene z znaki sem naredila. Ustavi se pri matematičnih vgrajenih funkcijah, kot so: sin,cos,log,...
In to kljub temu, da je uvožen matematični paket.
del kode:
Kalkulator je narejen s pomočjo pakata Tkinter. Dodati moram metode za računske operacije. Operacije, ki so predtsvaljene z znaki sem naredila. Ustavi se pri matematičnih vgrajenih funkcijah, kot so: sin,cos,log,...
In to kljub temu, da je uvožen matematični paket.
del kode:
class Calculator(Frame): def __init__(self, parent=None): Frame.__init__(self, bg='gray40') self.pack(expand=YES, fill=BOTH) self.master.title('Tkinter Toolkit TT-42') self.master.iconname('Tk-42') self.calc = Evaluator() # This is our evaluator self.buildCalculator() # Build the widgets # This is an incomplete dictionary - a good exercise! self.actionDict = {'second': self.doThis, 'mode': self.doThis, 'delete': self.doThis, 'alpha': self.doThis, 'stat': self.doThis, 'math': self.doThis, 'matrix': self.doThis, 'program': self.doThis, 'vars': self.doThis, 'clear': self.clearall, 'sin': self.sinus, 'cos': self.doThis, 'tan': self.doThis, 'up': self.doThis, 'X1': self.doThis, 'X2': self.doUp, 'log': self.logaritem, 'ln': self.doThis, 'store': self.doThis, 'off': self.turnoff, 'neg': self.doThis, 'enter': self.doEnter, } self.current = "" #za drugo potenco def doUp(self,action): #pravilen izraz za izračun self.current = self.current + '**2' #pravilen izpis na displeju self.display.insert(END,'X2')
- spremenil: Mavrik ()

t27522090 ::
You can find information about the "calculadora de Alicia para dividir" and adding advanced math functions like sin, cos, and log in Tkinter-based calculators here. Ensure the math module is imported (import math) and map functions like math.sin to your actionDict.
Zgodovina sprememb…
- predlagalo izbris: HotBurek ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | python-rabim pomočOddelek: Programiranje | 2824 (1054) | rnla1973 |
» | Python - pomoč (strani: 1 2 3 )Oddelek: Programiranje | 18340 (9088) | black ice |
» | Predstavitev dvojiškega drevesa z seznamomOddelek: Programiranje | 2008 (1608) | ktka |
» | python -slovarOddelek: Programiranje | 3174 (2153) | Valex86 |
» | [python] prednosti in slabostiOddelek: Programiranje | 2601 (2177) | Gundolf |