Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Tkinter button icons

import tkinter as tk
from tkinter import *
from PIL import Image, ImageTk
root = tk.Tk()
def change_i():
    if sound_btn.image == icon:
        #start_recording()

        sound_btn.config(image=icon2)
        sound_btn.image = icon2
    else:
        #stop_recording()

        sound_btn.config(image=icon)
        sound_btn.image = icon

icon = PhotoImage(file='dh.png')
icon2 = PhotoImage(file='stop.png')

sound_btn = tk.Button(root, image=icon, width=70,height=60,relief=FLAT ,command=change_i )
sound_btn.image = icon
sound_btn.grid(row=0, column=1)
root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: python get username windows 
Python :: python string cut substring 
Python :: python join paths 
Python :: flask upload file to s3 
Python :: openpyxl xls 
Python :: select rows which entries equals one of the values pandas 
Python :: scatter plot of a dataframe in python 
Python :: python - removeempy space in a cell 
Python :: python insert object into list 
Python :: python script to read all file names in a folder 
Python :: boxplot pandas 
Python :: key press python 
Python :: setting a condition for perfect square in python 
Python :: two loop type python 
Python :: default ordering django 
Python :: plt.suptitle position 
Python :: python add to list with index 
Python :: add text to the middle of the window tkinter 
Python :: python deque 
Python :: new in python 
Python :: sending email in django 
Python :: discord py color 
Python :: django jalali date 
Python :: pandas create new column and fill with constant value 
Python :: flask render_template 
Python :: how to set up a postgress database for your django projecrt 
Python :: how to uninstall python idle on ubuntu 
Python :: pandas string to number 
Python :: python beautifulsoup get content of tag 
Python :: how to get something from a certian possition in a list python 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =