import tkinter as tk class Test: def __init__(self): self.root = tk.Tk() self.root.geometry("250x100") self.buttonA = tk.Button(self.root, text="Color", bg="blue", fg="red") self.buttonB = tk.Button( self.root, text="Click to change color", bg="gray", fg="purple" )...
(): # for child in window.TKroot.frame.children.values(): try: color = current_them.get(element.Type.upper()) if color: if element.Type == 'button': element.Widget.config(foreground=color[0], background=color[1]) else: element.Widget.config(background=color) element.update() except...
from tkinter import* root=Tk() root.title() root.geometry('450x350') btn1=Button(root,text='1') btn1.place(x=200,y=50,width=40,height=40) def changebg(event): #鼠标移到按钮上按钮变红 event.widget['bg']='red' def changebg1(event): #鼠标离开按钮上按钮变蓝 event.widget['bg']...
width Size of the Colorscale in the X dimension. Example: from tkinter import * from tkmacosx import Colorscale, ColorVar root = Tk() root['bg'] = '#333' bgvar = ColorVar(value='#333') fgvar = ColorVar(value='white') Label(root, text="I am a Label, Hello! :-)",bg=bgvar...
有问题找客服
from tkinter import * class Window(Frame): Source:https://pythonbasics.org/tkinter-button/ ImpulseAdventuretransferred this issue from ImpulseAdventure/GUIsliceSep 2, 2019 Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment ...