D
D
Duckbill32132019-09-11 20:47:18
Python
Duckbill3213, 2019-09-11 20:47:18

Is it possible to link multiple widgets at once in tkinter?

And hello again.
This time I am writing an entertainment program that has a button that calls the "console" (I created the console in a separate function)
There are 2 main widgets in the console
1 - Multiline Text field
2 - Button
Is it possible to somehow link these 2 buttons, and so that When you enter certain text in a field such as "Wifi"
and then click on the button, the function was performed?
The code:

from tkinter import *
from tkinter import Toplevel
from tkinter import ttk
from tkinter import messagebox as mb
from tkinter.ttk import Combobox
def child_HELP():
  top=Toplevel(root)
  top.configure(background='black')
  lab=Label(top,text='Меню сетевых функций',width=75,height=20,font='Arial 17',fg='#00FF00',bg='black').pack()
  button1=Button(top,text="WI-FI",width=30,height=10,bg='black',fg='#00FF00',font='Arial 17',command=topess).pack()
#FUNCTIONS FOR VIRUS
def child_PIP():
  top2=Toplevel(root)
  top2.geometry('500x500')
  top2.configure(background='black')
  lab = Label(top2,text='Число:',bg='black',fg='#00FF00',font='Arial 10').pack()
  lab2 = Label(top2,text='Не указано',bg='black',fg='#00FF00',font='Arial 8').place(x=270,y=0)
  entry = Entry(top2,bg='#00FF00',fg='black',width=30).pack()
  but4=Button(top2,text='Черный троян',bg='black',fg='#00FF00').pack()
#FUCTION FOR WI-FI
def topes():
    top = Toplevel(root,bg='#FF0000')
    top.geometry('500x500')
    lab = Label(top,text='Загрузка...',bg='#FF0000',fg='black',font='Arial 17')
    pb = ttk.Progressbar(top,orient='horizontal',length=200,mode='determinate')
    lab.pack()
    pb.pack()
    pb.start()
#FUNCTIONS FOR CONSOLE
def console():
    top = Toplevel(root)
    top.geometry('800x200')
    top.configure(background='black')
    lab1 = Label(top,text='Username:',bg='black',fg='#00FF00',font='Arial 13').place(x=0,y=0)
    txt = Text(top,width=200,bg='black',fg='#00FF00',font='Arial 13').place(x=85,y=0)
    but1 = Button(top,text='Проверить',bg='#00FF00',fg='black',command=cons).pack()
def cons():
    top = Toplevel(root)
    lab = Label(top,text='WI-FI HAS BEEN HACKED!\nPASSWORD:39054074',bg='#FF0000',fg='black').pack()
    button1 = Button(top,text='escape the window').pack()
#FUNCTIONS_SMALL
def topess():
  top = Toplevel(root)
  top.configure(background='#00FF00')
  top.geometry('500x500')
  lab = Label(top,text='Введите пароль',font='Arial 10',bg='#00FF00').pack()
  entry = Entry(top,bg='#00FF00',fg='black').pack()
  but1 = Button(top,text='Ввойти',bg='#00FF00',fg='black',command=topes).pack()
def prints():
  print('Hello world!')

root = Tk()
root.title('Mortal app')
root.geometry('1020x620')
root.configure(background='#FF0000')
but1 = Button(root,text='Сеть',width=20,height=3,bg='#FF0000',fg='black',command=child_HELP)
but2 = Button(root,text='Вирус',width=20,height=3,bg='#FF0000',fg='black',command=child_PIP)
but3 = Button(root,text='Консоль',bg='#FF0000',fg='black',width=20,height=3,command=console)
combo = Combobox(root)
combo['values']=(1,2,3,4,5,'TEXT01')
combo.current(1)
combo.pack()
but1.pack()
but2.pack()
but3.pack()
root.mainloop()

#FUNCTIONS FOR CONSOLE are those functions in which I need to link 2 widgets.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question