Apr-06-2019, 09:20 PM
The documentation doesn't help!
If I have (forget the variables except the ones I need help with and not all statements are shown):
If I have (forget the variables except the ones I need help with and not all statements are shown):
root = tk.Tk() root.geometry('%sx%s+%s+%s' % (Xsize, Ysize, Xoffset, Yoffset)) label=tk.Label(root, textvariable=time_str, font=label_font, bg=bg_color, fg=Number_Color.get(), relief='raised', bd=3) label.pack(fill='x', padx=5, pady=5) label.config(fg=Number_Color.get()) root.mainloop()Questions:
- Does the word root have any particular meaning. Can I call it "xyz"?
- I assume the "root" in line 1 and the "root" in line 2 have to be the same name. True?
- Does "label" have any specific meaning? Can I call it "abc"?
- Why do some things use "root." and others use "label."?
- Does "root.mainloop" (line 7) have any relationship to the "root=" (line 1) or could it be "def"?
- If I call a function, do I have to pass it the "root" and "label" names (or "global" them) or is that implicit?
- If I want two different independent tk labels, do I call one "root1" & "label1" and the other "root2" and "label2" to use them independently? Can I use myroot[0] and mylabel[0] and myroot[1] and mylabel[1] so I can select either of them by selecting 0 or 1?
- If I have two different but the same type of widget (like two Label widgets) and I want to call a single function to update the contents, geometry, etc. of the one selected, would I pass the "root" and "label" names as parameters so the function operated on the referenced one?
- If I have a Label at a location and want to make it smaller, do I just use the modification commands like label.config or should I destroy the label and create a new one? Why?
- What happens if I put one label over another? If I destroy the second, will the first one show on the screen?
- If I have a certain picture for a background on the screen from outside python and I create a label then either remove it or the program ends, will the background be there or will there be "holes" where the label was which means I have to restore the background? What if the python program is "kill"ed?