Как можно il oop через поле ввода или виджет ввода в python tkinter - PullRequest
0 голосов
/ 20 июня 2020

У меня проблема. Как я могу l oop через поле ввода или виджет ввода в python tkinter?. Я хочу, чтобы поле ввода было l oop в соответствии с указанным диапазоном, и останавливает l oop, если оно выходит за пределы диапазона. Затем отключите запись feilds

Вот мой код:

global myButton
global myButton1
global number_of_Supervisors
global count
global supervisors

Сначала мои функции:

def placeLocation():
    global supervisors
    i = 0
    Place1 = e1.get()
    Location1 = e2.get()

    while i <= supervisors:
        if Place1 == "" or Location1 == "":
            messagebox.showinfo("Warning", "Fill The Fields First")
        elif Place1 != "" or Location1 != "":
            e1.delete(0, END)
            e2.delete(0, END)
        else:
            e1.configure(state=DISABLED)
            e2.configure(state=DISABLED)


def numberOfSuperV():
    global number_of_Supervisors
    global myButton1
    global supervisors

    number_of_Supervisors = e.get()
    supervisors = int(number_of_Supervisors)
    if number_of_Supervisors == "":
        messagebox.showerror("Error", "Please Fill In Number of SuperVisors")
    else:
        e1.configure(state=NORMAL)
        e2.configure(state=NORMAL)
        e.configure(state=DISABLED)
        myButton.configure(state=DISABLED)

А потом код вызова:

myButton1 = ttk.Button(main_window, text="FIND ROUTE",command=placeLocation, style="C.TButton",  width=30)
myButton1.place(x=60, y=350)
myButton = ttk.Button(main_window, text="ENTER", command=numberOfSuperV, style="C.TButton", width=10)
myButton.place(x=240, y=205)

Любая помощь приветствуется Танки

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...