Я хочу создать приложение, которое пробивает (так сказать) номера телефонов.
В функции def select_but хочу сделать так, что бы при нажатии на self.but_5, автоматически активировались CheckButtons: self.but_3 и self.but_4. Я про
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
from colorama import Fore, Style
class NumBer(Tk):
__Modes = ('Beginner', 'Advanced', 'Pro')
__Site = 'https://www.youtube.com/channel/UCSE7WXuUfcMOLCIfXR0hI_w'
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.get(), 'None')
carrier_1 = carrier.name_for_number(x, 'ru')
regionn = geocoder.description_for_number(x, 'ru')
timez = timezone.time_zones_for_number(x)
messagebox.showinfo('Answer', f'Регион:\n{regionn}\nЧасовой пояс:\n{timez}\nМобильный оператор:\n{carrier_1}')
def clear(self):
self.ent_1.delete(0, 'end')
def select_but(self):
for self.check in [self.but_3, self.but_4]:
self.check.select() (ЭТОТ КОД У МЕНЯ НЕ РАБОТАЕТ, НАЖИМАЮ И НИЧЕГО НЕ ПРОИСХОДИТ)
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()