Tak uz sem rovnou hodim tu "kalkulacku" funkcni...
# -*- coding: utf-8 -*-
from Tkinter import *
root = Tk()
def krat ():
Kra = int(cisloKrat.get())
Kraa = int(cisloKratDve.get() )
kratVysl.insert(0, Kra*Kraa) #tady jsi mel misto Kra*Kraa jen kr
def delit ():
Del = int(cisloDelit.get())
Dell = int(cisloDelitDve.get())
delitVysl.insert(0, Del / Dell) #tady bylo Del / Del...
def plus ():
Plu = int(cisloPlus.get())
Pluu = int(cisloPlusDve.get())
plusVysl.insert(0, Plu + Pluu)
def minus ():
Min = int(cisloMinus.get())
Minn = int(cisloMinusDve.get())
minusVysl.insert(0, Min - Minn)
cisloKrat = Entry(root,width = 20)
cisloKrat.grid(row = 0, column = 0) #<---------------------
cisloDelit = Entry(root,width = 20) # |
cisloDelit.grid(row = 1, column = 0) #tady jsi mel tohle |
cisloPlus = Entry (root,width = 20)
cisloPlus.grid(row = 2, column = 0)
cisloMinus = Entry (root, width = 20)
cisloMinus.grid(row = 3, column = 0)
_krat = Label (root, text = "*") #tyhle stitky ti prepisovali vsechny funkce
_krat.grid(row = 0, column = 1)
_delit = Label (root, text = "/")
_delit.grid(row = 1, column = 1)
_plus = Label (root, text = "+")
_plus.grid( row = 2, column = 1)
_minus = Label (root, text = "-")
_minus.grid(row = 3, column = 1)
cisloKratDve = Entry(root,width = 20)
cisloKratDve.grid(row = 0, column = 2)
cisloDelitDve = Entry(root,width = 20)
cisloDelitDve.grid(row = 1, column = 2)
cisloPlusDve = Entry(root,width = 20)
cisloPlusDve.grid(row = 2, column = 2)
cisloMinusDve = Entry(root,width = 20)
cisloMinusDve.grid(row = 3, column = 2)
kratVysl = Entry(root,width = 50)
kratVysl.grid(row = 0, column = 4)
delitVysl = Entry (root,width = 50)
delitVysl.grid (row = 1, column = 4)
plusVysl = Entry(root,width = 50)
plusVysl.grid (row = 2, column = 4)
minusVysl = Entry (root, width = 50)
minusVysl.grid(row = 3, column = 4)
TkratVysl = Button(root, text = "=", command = krat)
TkratVysl.grid(row = 0, column = 3)
TdelitVysl = Button (root, text = "=", command = delit)
TdelitVysl.grid (row = 1, column = 3)
TplusVysl = Button(root, text = "=", command = plus)
TplusVysl.grid(row = 2, column = 3)
TminusVysl = Button(root, text = "=", command = minus)
TminusVysl.grid (row = 3, column = 3)
mainloop()