Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change color of butto in thkinter

button = Button(tkWindow, bg='blue')
button = Button(tkWindow, bg='black')
button = Button(tkWindow, bg='white')
button = Button(tkWindow, bg='red')
#hex values
button = Button(tkWindow, bg='#54FA9B')
button = Button(tkWindow, bg='#A877BA')
Comment

python tkinter button color

def fade(widget, smoothness=4, cnf={}, **kw):
    """This function will show faded effect on widget's different color options.

    Args:
        widget (tk.Widget): Passed by the bind function.
        smoothness (int): Set the smoothness of the fading (1-10).
        background (str): Fade background color to.
        foreground (str): Fade foreground color to."""

    kw = tk._cnfmerge((cnf, kw))
    if not kw: raise ValueError("No option given, -bg, -fg, etc")
    if len(kw)>1: return [fade(widget,smoothness,{k:v}) for k,v in kw.items()][0]
    if not getattr(widget, '_after_ids', None): widget._after_ids = {}
    widget.after_cancel(widget._after_ids.get(list(kw)[0], ' '))
    c1 = tuple(map(lambda a: a/(65535), widget.winfo_rgb(widget[list(kw)[0]])))
    c2 = tuple(map(lambda a: a/(65535), widget.winfo_rgb(list(kw.values())[0])))
    colors = tuple(colour.rgb2hex(c, force_long=True)
                   for c in colour.color_scale(c1, c2, max(1, smoothness*100)))

    def worker(count=0):
        if len(colors)-1 <= count: return
        widget.config({list(kw)[0] : colors[count]})
        widget._after_ids.update( { list(kw)[0]: widget.after(
            max(1, int(smoothness/10)), worker, count+1) } )
    worker()
#source: https://stackoverflow.com/questions/49433315/is-there-a-wayor-a-library-for-making-a-smooth-colour-transition-in-tkinter
Comment

how to change the color of a button in python tkinter

from tkinter import * 
import time
import random

Main_screen = Tk()
Main_screen.title("Log in screen")#setting the title of the log in screen
Main_screen.geometry("700x300")# setting the defalt size of the log in screen

Label(Main_screen,text="Welcome To Empire of programmers login system",font=("Bold", 20)).pack()

Label(Main_screen,text="User Name:- ").pack()
User_name = Entry(Main_screen)#Making the entry box for getting the User name for log in
User_name.pack()

Label(Main_screen,text="Password:- ").pack()
User_name = Entry(Main_screen,show="#")#Making the entry box for getting the User Password for log in and insted of showing the Entry password showing it with an #
User_name.pack()

Button(Main_screen,text="Log in", bg="light blue").pack()

Main_screen.mainloop()
Comment

gui button in tkinter color

import Image as PIL
import ImageTk
Comment

tkinter change ttk button color

button = tk.Button(root, text="Sign Out", bg='red', command= lambda: controller.show_frame(10)) #, highlightthickness = 0, bd = 0)
button.grid(row=3, column=0, sticky='ne', padx=20, pady=50)
Comment

how to set background color for a button in tkinter

from tkinter import *
root = Tk()
button = Button(root, bg='red')  # Background color = red
button.pack()
root.mainloop
Comment

PREVIOUS NEXT
Code Example
Python :: Python NumPy concatenate Function Example when axis equal to 1 
Python :: render django views 
Python :: plotly subplots 
Python :: pd df iloc 
Python :: pandas in python 
Python :: count values python 
Python :: PHP echo multi lines Using Nowdoc variable 
Python :: python break 
Python :: django redirect url 
Python :: python destructure object 
Python :: python draw tree 
Python :: Python Tkinter TopLevel Widget 
Python :: Count the number of cells that contain a specific value in a pandas dataframe python 
Python :: python dict in dict 
Python :: Django serializer, 
Python :: def calc_mean_mode(df, column_name) 
Python :: python calculations with variable x (letter) 
Python :: pandas series add word to every item in series 
Python :: Python Tuples Tuples allow duplicate values 
Python :: python if index not out of range 
Python :: how to close ursina screen 
Python :: matplotlib remove white lines between contour 
Python :: dataframe to csv 
Python :: python create valid filename from string 
Python :: simulate gravity in pythpn 
Python :: Python Try Except Else Clause 
Python :: how to remove groups/user_permissions from user admin panel in django,how to edit fields shown on user admin panel 
Python :: convert numpy array to tfrecord and back 
Python :: stack widgets in tkinter 
Python :: get sum of column before a date python 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =