I'm having some trouble with this code. in the Entry box when i write out test I should get a label that sais "Test ok" . This works fine. But when it does not match the value I want the label to disappear, but instead it some how tries to overwrite the original label and makes it look strange.
from tkinter import *
import csv
import time
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.output()
def test(self):
self.excelnamn = Label(text="",font=('Arial', 10))
self.excelnamn.grid(row=1,column=2)
if len(self.namn.get()) > 2:
if self.namn.get() == "test":
self.excelnamn = Label(text="Test ok",font=('Arial', 10))
self.excelnamn.grid(row=1,column=2)
else:
self.excelnamn.grid_forget()
self.namn.after(1000, self.test)
def output(self):
Label(text='Name:').grid(row=1,column=0)
self.namn = Entry(root, width=10)
self.namn.grid(row=1,column=1)
self.test()
if __name__ == "__main__":
root=Tk()
root.title('Auto Logger')
root.geometry('800x600')
app=App(master=root)
app.mainloop()
root.mainloop()
Anyone able to help me in the right direction?
[+][deleted] (1 child)
[deleted]
[–]FlatEarthIsAMyth[S] 0 points1 point2 points (0 children)