原文
1. options
1 2 3 4 5 6
| val = cget(“option”) => string config(option=value, …) configure(option=value, …) val = elem["option"] elem["option"] = "value" button = Button(frame, {"text": "QUIT", "fg": "red", "command": frame.quit})
|
2. print the method and options
1 2
| print (elem.keys()) print (dir(elem))
|
3. styling
1 2
| rgb = widget.winfo_rgb("red") red, green, blue = rgb[0]/256, rgb[1]/256, rgb[2]/256
|
3. fonts
1 2 3 4 5 6 7 8 9 10 11
| ("Times", 10, "bold") ("Helvetica", 10, "bold italic") ("Symbol", 8) "Times 10 bold" "Helvetica 10 bold italic" "Symbol 8" tkFont.Font(family="Times", size=10, weight=tkFont.BOLD) tkFont.Font(family="Helvetica", size=10, weight=tkFont.BOLD, slant=tkFont.ITALIC) tkFont.Font(family="Symbol", size=8)
|
4. Text Formatting
1. border
1 2 3 4 5 6
| borderwidth (or bd) relief = highlightcolor highlightbackground highlightthickness
|
1. cursor