Я создаю приложение, используя tktinter в python. Я создал кнопку под названием «Новая задача», которая вызывает функцию, в которой пользователь может ввести ссылку, затем я создал другую кнопку, где вызывается другая функция, где введенная пользователем ссылка распечатывается в консоли, но почему-то каждый раз ничего не печатает. Пожалуйста, помогите, вот код
from tkinter import *
from tkinter.ttk import *
import tkinter as tk
LARGE_FONT= ("Verdana", 12)
class SeaofBTCapp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (Task,LoginPage):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column = 0, sticky="nsew")
self.show_frame(Task)
def show_frame(self, cont):
#for frame in self.frames.values():
#frame.grid_remove()
frame = self.frames[cont]
frame.tkraise()
frame.winfo_toplevel().geometry("1024x720")
frame.configure(bg='#333130')
class LoginPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text=" Page 1", font=LARGE_FONT)
label.pack(pady=10, padx=10)
#loggedin(self, parent, controller)
class Task(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
c = Canvas(self, height=50, width=102400, bg="#333130")
c.pack()
homebutton = tk.Button(self, text='Home', command=lambda: controller.show_frame(HypeExtractor))
homebutton_window = c.create_window(10, 12.5, anchor=tk.NW, window=homebutton)
taskbutton = tk.Button(self, text='Task', command=lambda: controller.show_frame(Task))
taskbutton_window = c.create_window(104, 12.5, anchor=tk.NW, window=taskbutton)
adressbutton = tk.Button(self, text='Your Adressess', command=lambda: controller.show_frame(YourAdressess))
adressbutton_window = c.create_window(196, 12.5, anchor=tk.NW, window=adressbutton)
paymentbutton = tk.Button(self, text='Payment', command=lambda: controller.show_frame(Payment))
paymentbutton_window = c.create_window(323, 12.5, anchor=tk.NW, window=paymentbutton)
newtaskbutton = tk.Button(self, text='New Task',command=lambda: taskcreator())
newtaskbutton_window = c.create_window(600, 12.5, anchor=tk.NE, window=newtaskbutton)
#endtaskbutton = tk.Button(self, text='End Task', command=lambda: taskcreator())
#endtaskbuttonn_window = c.create_window(690, 12.5, anchor=tk.NE, window=endtaskbutton)
RunningTask = tk.Label(self, text='Running Task').place(x=10,y=75,anchor=tk.NW)
#canvas = Canvas(self, width=60, height=60)
#canvas.place(x=10, y=30)
def taskcreator():
global screen
screen = Tk()
thelink = StringVar()
screen.geometry('720x640')
Label(screen, text='Enter Shoe Link').place(x=10, y=20)
linkentry = Entry(screen, textvariable=thelink)
linkentry.place(x=10, y=40)
you = Button(screen, text='End Task', command=lambda: assign(thelink))
you.pack()
screen.mainloop()
def assign(thelink):
link = thelink.get()
# print(llink.get())
print(thelink.get())
app = SeaofBTCapp()
app.mainloop()
Заранее благодарим за вашу помощь!