» »

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:

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 ()

FrEaKmAn ::

kako misliš da se ustavi? dobiš napako? ne znaš sprogramirat?

ktka ::

Ja, ne znam sprogramirat.

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 ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

python-rabim pomoč

Oddelek: Programiranje
162824 (1054) rnla1973
»

Python - pomoč (strani: 1 2 3 )

Oddelek: Programiranje
10318340 (9088) black ice
»

Predstavitev dvojiškega drevesa z seznamom

Oddelek: Programiranje
142008 (1608) ktka
»

python -slovar

Oddelek: Programiranje
223174 (2153) Valex86
»

[python] prednosti in slabosti

Oddelek: Programiranje
132601 (2177) Gundolf

Več podobnih tem