“Exception in Tkinter callback
Traceback (most recent call last):
File ”C:\Python27\lib\lib-tk\Tkinter.py“, line 1410, in __call__
return self.func(*args)
File ”D:\Институт\питон прога\osnovav2_5.py“, line 35, in tenvtwo
txt_val = float(text1.get())
TypeError: get() takes at least 2 arguments (1 given)
”
ну и где мне взять второй аргумент.
# -*- coding: cp1251 -*- # -*- coding: UTF-8 -*- from Tkinter import * from sys import* def exit(): """Выход из проги""" root.destroy() def solver(text1): if x1 >= 0: x1= bin(text1) text = "this nuber is: %s \n x1"%(text1, x1) return text def solver(txt_val1): if x1>=0: x1=oct(txt_val1) text = "this nuber is: %s \n x1"%(txt_val1, x1) return text def inserter(value): """ Функция вставки информации """ output.delete("0.0","end") output.insert("0.0",value) def clear(event): """ Очищает поле """ caller = event.widget caller.delete("0", "end") def tenvtwo(): try: txt_val = float(text1.get()) inserter(solver(txt_val)) except ValueError: inserter("nevernoe chislo") def tenveight(): try: txt_val1=int(text1.get()) inserter(solver(txt_val1)) except ValueError: inserter("nevernoe chislo") def tenvsixteen(): inserter("lol3") def twovten(): inserter("lol4") def sixteenvten(): inserter("lol5") def twovsixteen(): inserter("lol6") def sixteenvtwo(): inserter("lol7") root = Tk() root.title(u"Калькулятор систем счисления") root.geometry('400x300') lab = Label(root, height=1, width=10, text=u"Ввод данных") lab.place(x=45,y=20) lab1 = Label(root, height=1, width=10, text=u"Результат") lab1.place(x=45,y=230) text1=Text(root,height=1,width=10,font='Arial 14',wrap=WORD) text1.bind("<FocusIn>", clear) text1.place(x=45,y=50) but2 = Button(root, bg="yellow", text=u"Выход", command=exit) but2.place(x=350,y=250) but3 = Button(root, bg="green", text=u"10 в 2", command = tenvtwo) but3.place(x=45,y=90) but4 = Button(root, bg="green", text=u"10 в 8", command = tenveight) but4.place(x=100,y=90) but5 = Button(root, bg="green", text=u"10 в 16", command = tenvsixteen) but5.place(x=170,y=90) but6 = Button(root, bg="green", text=u"2 в 10", command=twovten) but6.place(x=240,y=90) but7 = Button(root, bg="green", text=u"16 в 10", command=sixteenvten) but7.place(x=45,y=120) but8 = Button(root, bg="green", text=u"2 в 16", command=twovsixteen) but8.place(x=100,y=120) but9 = Button(root, bg="green", text=u"16 в 2", command=sixteenvtwo) but9.place(x=170,y=120) output = Text(root, font="Arial 14", height=1, width=10) output.bind("<FocusIn>", clear) output.place(x=48,y=250) mainloop()