White line through optionmenu
White line through optionmenu
I get a weird line through my optionmenu and I have no idea why. Any tips? Just test code, but I have no idea where that line comes from. I've tried changing the size of the menu to fix it and tried to find the error but I just can't find it. It's not "game-breaking" but it's still kinda annoying that I can't get rid of it.
from tkinter import *
root = Tk()
root.state("zoomed")
root.title("XP-dot GUI")
root.configure(background='black')
mainframe = Frame(root, width=50)
mainframe.grid(row=0, column=0, sticky=(N,W,E,S))
mainframe.columnconfigure(0, weight = 1)
mainframe.rowconfigure(0, weight = 1)
buttonframe = Frame(root)
buttonframe.grid(row=3, column=0, sticky=(N,W))
buttonframe.configure(background='blue')
tkvar = StringVar(root)
tkvar.set('1 row')
choices = ['1 row','2 rows','Still frame','Animation', 'diy']
r=0
c=0
theLabel = Label(root, text="")
theLabel.grid(row=r,column=c)
dropDown = OptionMenu(mainframe, tkvar, *choices)
Label(mainframe, text="Options").grid(row=r, column=c)
dropDown.grid(row=r, column=c+1, sticky=(W,E))
dropDown.config(width=14)
def preview():
print ("value is", tkvar.get())
button = Button(buttonframe, text="Preview", command=preview)
button.grid(row=5,column=0)
def random():
print ("value is", tkvar.get())
button = Button(buttonframe, text="Randomize", command=random)
button.grid(row=5,column=1)
def update():
print ("value is", tkvar.get())
button = Button(buttonframe, text="Update", command=update)
button.grid(row=5,column=2)
root.mainloop()
1 Answer
1
That "line" is theLabel
. Both it and mainframe
have been put in row 0, column 0 of the root window.
theLabel
mainframe
You can see this more clearly if you give theLabel
some text. Because it doesn't have any text, it appears as a fairly small rectangle. Because it was added after mainframe
was added to root, it appears on top of mainframe
.
theLabel
mainframe
mainframe
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.