Я хочу создать приложение, которое пробивает (так сказать) номера телефонов.
И у меня возникает ошибка в функции code_1:
TypeError: object of type 'Entry' has no len()
from tkinter import ttk
from tkinter import Tk
import tkinter
from tkinter import *
import phonenumbers
import webbrowser
import tkinter.messagebox
from tkinter import messagebox
from phonenumbers import geocoder
from phonenumbers import carrier
from phonenumbers import timezone
class NumBer(Tk):
__Modes = ('Beginner', 'Advanced', 'Pro')
__Site = 'КОЕ КАКОЙ КАНАЛ, Но ЗНАЙТЕ, ЧТО ТУТ МОЖЕТ БЫТЬ ЛЮБАЯ ССЫЛКА'
def __init__(self):
Tk.__init__(self)
self.geometry('300x200')
self.title('HeroPhone')
self.resizable(False, False)
self.configure(bg='#293133')
self.gui()
self.ico_cm()
def ico_cm(self):
self.photo = tkinter.PhotoImage(file='callico.png')
self.iconphoto(False, self.photo)
def close(self):
exit()
def brows(self):
webbrowser.open_new(url=self.__Site)\
def code_1(self):
x = phonenumbers.parse(self.ent_1, 'None')
carrier_1 = carrier.name_for_number(x, 'ru')
carrier_2 = print(carrier_1)
regionn = geocoder.description_for_number(x, 'ru')
messagebox.showinfo(carrier_2, 'Info')
def clear(self):
self.ent_1.delete(0, 'end')
def gui(self):
self.ent_1 = Entry(self,width=36)
self.ent_1.place(x=75, y=11)
self.lab_1 = Label(self, text='Find:',width=7, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=10, y=10)
self.lab_2 = Label(self, text='Options:',width=7, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=10, y=40)
self.but_1 = Button(self, text='Close',command=self.close, width=7, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=228, y=165)
self.but_2 = Button(self, text='Start',command=self.code_1, width=11, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=125, y=165)
self.but_3 = Checkbutton(self, text='Fast', font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=77, y=40)
self.but_4 = Checkbutton(self,text='Show', font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=136, y=40)
self.but_6 = Button(self, text='Url',command=self.brows,width=9, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=208, y=68)
self.combo_1 = ttk.Combobox(self, values=NumBer.__Modes, width=11)
self.combo_1.current(0)
self.combo_1.place(x=205, y=40)
self.but_5 = Button(self, text='Select all', width=15, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=75, y=70)
self.but_7 = Button(self, text='Clear',command=self.clear, width=6, font=('KTF Jermilov Regular 400', 10, 'bold')).place(x=10, y=70)
root = NumBer()
root.mainloop()