In this video I’ll show you how to ring the system bell with Tkinter and Python.
There are many situations when you might need to ring the system bell in your app. Luckily, it’s incredibly easy to do with Tkinter.
All you have to do is call root.bell()
In this video we’ll make a fun little app with a picture of a bell and a button that you can click to make the system bell ring.
Python Code: bell.py
from tkinter import * root = Tk() root.title('Codemy.com - Ring The Bell!') root.iconbitmap('c:/gui/codemy.ico') root.geometry("500x500") # Define image bell = PhotoImage(file="images/bell.png") # Add image to label bell_label = Label(root, image=bell) bell_label.pack(pady=20) # create ring function def ring(): root.bell() # Create our button my_button = Button(root, text="Ring The Bell", command=ring, font=("Helvetica", 24), fg="#4d4d4d") my_button.pack(pady=20) root.mainloop()
Your videos are really cool and your algorithm of writing code is the easiest and sometimes little bit tricky.