Python GUI buttons 🛎️

  Рет қаралды 73,144

Bro Code

Bro Code

4 жыл бұрын

You guys don't need all the button.config() calls, you can place them within the constructor if you want. I like to add comments line-by-line for teaching purposes to help explain. Do what works for you.
Python Tkinter GUI button tutorial for beginners
#Python #Tkinter #GUI #button #buttons #tutorial #beginners
button = you click it, then it does stuff
from tkinter import *
count = 0
def click():
global count
count+=1
label.config(text=count)
#label2.pack()
window = Tk()
button = Button(window,text='Click me!!!')
button.config(command=click) #performs call back of function
button.config(font=('Ink Free',50,'bold'))
button.config(bg='#ff6200')
button.config(fg='#fffb1f')
button.config(activebackground='#FF0000')
button.config(activeforeground='#fffb1f')
image = PhotoImage(file='point_emoji.png')
button.config(image=image)
button.config(compound='bottom')
#button.config(state=DISABLED) #disabled button (ACTIVE/DISABLED)
label = Label(window,text=count)
label.config(font=('Monospace',50))
label.pack()
button.pack()
label2 = Label(window,image=image)
window.mainloop()

Пікірлер: 102
@BroCodez
@BroCodez 4 жыл бұрын
# button = you click it, then it does stuff from tkinter import * count = 0 def click(): global count count+=1 label.config(text=count) #label2.pack() window = Tk() button = Button(window,text='Click me!!!') button.config(command=click) #performs call back of function button.config(font=('Ink Free',50,'bold')) button.config(bg='#ff6200') button.config(fg='#fffb1f') button.config(activebackground='#FF0000') button.config(activeforeground='#fffb1f') image = PhotoImage(file='point_emoji.png') button.config(image=image) button.config(compound='bottom') #button.config(state=DISABLED) #disabled button (ACTIVE/DISABLED) label = Label(window,text=count) label.config(font=('Monospace',50)) label.pack() button.pack() label2 = Label(window,image=image) window.mainloop()
@seemakadav7812
@seemakadav7812 3 жыл бұрын
Ok
@aeaeaeaeaeaeaeaeaeae7283
@aeaeaeaeaeaeaeaeaeae7283 2 жыл бұрын
Hey, can u show me all the packages u use? the function "Label" "Button" and a lot of functions aint working
@yaman09
@yaman09 Жыл бұрын
hey how do i make the window 200,600 and how do i add multipule buttons and position them?
@aserramy_7
@aserramy_7 9 ай бұрын
can you tell me the editor you used in this video
@jstarandomracoon
@jstarandomracoon 7 ай бұрын
hey Bro look what I made import tkinter import tkinter as tk y = "" x = "" def click(): x="I know it""\U0001F923" label.config(text=x) def click1(): y="wrong! you are Gay bro""\U0001F923" label.config(text=y) root = tk.Tk() root.geometry("320x250") root.title("from ayman to U") label= tk.Label(root, text="are you Gay?""\U0001F642", font=("smart", 20)) label.pack() button = tk.Button(root, text="Yes") button.config(command=click) button.config(font=("Ink free",15,"bold")) button.config(bg="#f20587") button.config(activebackground="#ff0000") label = tk.Label(root, text=x) label.config(font=("Ink free",20,"bold")) label.pack() button.pack() button = tk.Button(root, text=" No") button.config(command=click1) button.config(font=("Ink free",15,"bold")) button.config(bg="#302e2f") button.config(activebackground="#34eb3d") label = tk.Label(root, text=y) label.config(font=("Ink free",20,"bold")) label.pack() button.pack() root.mainloop()
@iqpprevail5976
@iqpprevail5976 Жыл бұрын
Actually makes sense unlike the other tutorials that don't explain why.. I'm subscribing and liking now.
@billgreen9168
@billgreen9168 Жыл бұрын
Cause There Indian?
@gurmit731
@gurmit731 2 жыл бұрын
Helped me a lot. Cheers!
@darkbeerdude
@darkbeerdude 5 ай бұрын
great tutorial! helpful and fun!
@mohamedselim6547
@mohamedselim6547 3 жыл бұрын
brief, to the point ... super keep it up
@SharpObject1990
@SharpObject1990 2 жыл бұрын
Nice concise guide. Simple.
@BobNeverStop
@BobNeverStop 2 жыл бұрын
Thanks i learnt more commands!
@marshallwages5035
@marshallwages5035 2 жыл бұрын
Isnt there a way to set the color of the button when the other parameters are being filled out? Like: button(root, text=" " , bg= 'red' ) ?
@imihaita8913
@imihaita8913 Жыл бұрын
that''s really cool!!!
@nandikajayampathi3426
@nandikajayampathi3426 2 жыл бұрын
you are so good to teach :) thank you very much
@laniakea3487
@laniakea3487 Жыл бұрын
Gaw damn this was so much helpful, I’ve been looking for how to understand these buttons and labels n how to change the color too and you helped me a lot, thank you
@EquaTechnologies
@EquaTechnologies 2 жыл бұрын
*_Amazing video! I already am saying that before the tutorial began!_* 😀👍
@zedgd5617
@zedgd5617 Жыл бұрын
lol then watch the tutorial youll like it more
@EquaTechnologies
@EquaTechnologies Жыл бұрын
@@zedgd5617 Okay, but I don't want now.
@randomdude7386
@randomdude7386 2 жыл бұрын
Okay, but assuming I don't want a counter, but to switch with every button press between arrays of informations from a database that would be displayed on screen through the label, what would that be possible?
@anokhautomation4453
@anokhautomation4453 2 жыл бұрын
Amazing. 🎉🎉🎉
@amegomusictv6535
@amegomusictv6535 Ай бұрын
Thanks to your tutorial I learned something logic
@hadiaal-amine3244
@hadiaal-amine3244 2 жыл бұрын
Great video. Thank you for writing the code in the comment. It is very helpful
@s.mohammedjunaith6152
@s.mohammedjunaith6152 2 жыл бұрын
And sooo good at teaching I can understand it very fast 😊😊😊
@s.mohammedjunaith6152
@s.mohammedjunaith6152 2 жыл бұрын
Another one is amazing in the discription Thanks for easy writing of code 😃😃😃😃😃
@adnerremy2650
@adnerremy2650 2 жыл бұрын
Your video is very well explained. If I add a fews entries, then a value to each of them. How can I get each of the values and add them up? Here are the codes. Thanks from tkinter import * root=Tk() somme=0 def add_button(): global somme somme +=1 for i in range(somme): lab1=Label(root, text='lab1') lab1.grid(row=i, column=1) entry1=Entry(root) entry1.grid(row=i, column=2) bouton_add=Button(root, text='Create widget', command=add_button ) bouton_add.grid(row=5, column=0) root.mainloop()
@redeye987
@redeye987 2 жыл бұрын
Thank you helped me a lot
@furyaj
@furyaj 2 жыл бұрын
very good video ty !
@jogusudhakar8421
@jogusudhakar8421 2 жыл бұрын
Thanks man that's awesome
@user-ev4xy4bi3s
@user-ev4xy4bi3s Жыл бұрын
relly helpful
@chimp6532
@chimp6532 2 жыл бұрын
This was so helpful thnxs
@nokta1190
@nokta1190 3 жыл бұрын
thank you 😊
@Zeroonezero527
@Zeroonezero527 2 жыл бұрын
thank you a lot a lot a lot
@user-gz3eq7oi9y
@user-gz3eq7oi9y 3 жыл бұрын
does anyone know how to make it so that when the button is holded it calles the same function as the command one you wrote
@Lav_jeswani
@Lav_jeswani Жыл бұрын
Love this guy...😂
@Bentleyloesch
@Bentleyloesch 6 ай бұрын
Would this be reasonable for creating a DAW?
@Ayushsharma-ly3wt
@Ayushsharma-ly3wt 7 ай бұрын
I want you to make a video about how to change button text also when clicked
@Dino90554
@Dino90554 3 жыл бұрын
thank you bro🙏
@catanja6891
@catanja6891 2 жыл бұрын
I dont want the counter. Can u show me how to put the text in the same window as the button when u press it?
@BronzeBagel
@BronzeBagel 3 жыл бұрын
The professionalism is surprising, but welcome.
@narekeskandarian6404
@narekeskandarian6404 Жыл бұрын
He deserves the profile picture
@sangeetharana4435
@sangeetharana4435 Жыл бұрын
Noice thanks for the code
@vash0158
@vash0158 2 жыл бұрын
Thanks
@NotSoz.
@NotSoz. 5 ай бұрын
i'm having trouble trying to run the code at 2:19. i try typing a tilde after "button.config(command=click)", but it gives me an error message. is there a solution to this?
@unkangkr
@unkangkr 2 жыл бұрын
Which extension pack should I download?
@By.0ne__pala
@By.0ne__pala Жыл бұрын
I have a question if we are on android(Acode) do this will work
@mohamedsalman6558
@mohamedsalman6558 2 жыл бұрын
think you
@emryscass7327
@emryscass7327 2 жыл бұрын
I have AttributeError when running button.config - The difference is I'm not using pack() because I'm setting up a TicTacToe game so I'm using grid. When I click the button, I'm calling a function that is supposed to update the text on the button.
@kleinerdiamant-bs
@kleinerdiamant-bs 2 жыл бұрын
10:40 OMG YOU ARE THE BEST. NEVER FOUND THIS ANYWHERE. Thank you so much. Like and sub!😱😱😱
@GalacticMurals
@GalacticMurals 8 ай бұрын
👍
@dumbaigd3863
@dumbaigd3863 2 жыл бұрын
print("cool vid")
@abhishekchikane6451
@abhishekchikane6451 2 жыл бұрын
bro can you make file upload button with basic ui for a proper idea (Not for html)?
@toastvernascher4533
@toastvernascher4533 Жыл бұрын
for some reason only the folder the python file was in just opened and nothing else happened. can someone help me?
@s.mohammedjunaith6152
@s.mohammedjunaith6152 2 жыл бұрын
Amazing but how to change the postion and size of the button and lable Also borders
@knownrobloxian3381
@knownrobloxian3381 2 жыл бұрын
What are you coding that on?
@theclasherplays7265
@theclasherplays7265 2 жыл бұрын
Great video , thanks for the code i understood it so now i can make an app
@Motivational_but_smarter
@Motivational_but_smarter 2 жыл бұрын
Only on buttons?
@eyoel9141
@eyoel9141 2 жыл бұрын
bro i am havinf problem named.... Tk() is not defined plz help me dude
@WildSpade
@WildSpade Жыл бұрын
I COMMECNTED OMG
@guyon6
@guyon6 2 жыл бұрын
hi, I have a question, what program r u using? Great video btw, rlly helped
@guyon6
@guyon6 2 жыл бұрын
is it tkinter?
@guyon6
@guyon6 2 жыл бұрын
Nevermind, it's called Pycham, thanks for the video!
@s.mohammedjunaith6152
@s.mohammedjunaith6152 2 жыл бұрын
One more question which module in python is best Sorry for soo many comments
@khitprod
@khitprod Жыл бұрын
Made beautiful angry chicken button
@IceDragonBoy3
@IceDragonBoy3 2 жыл бұрын
Why do I get error window = Tk() NameError: name "Tk" is not defined :(
@toamna_7323
@toamna_7323 2 жыл бұрын
i don't understand,, how can i download this version of python??
@salehninjax5583
@salehninjax5583 2 жыл бұрын
i just want to help you that is why a commented
@a_star_official_
@a_star_official_ Жыл бұрын
is this on virtual code studio
@hash261k
@hash261k 11 ай бұрын
Bro help me how to import an image with a phone please i beg of you
@anubhav4830
@anubhav4830 3 жыл бұрын
Hey, I want to make a button . whose state =DISABLED , but when I enter something in textbox that button got enabled. from tkinter import * fenster = Tk() fenster.title("Window") def switch(): if b1["state"] == "normal": b1["state"] = "disabled" b2["text"] = "enable" else: b1["state"] = "normal" b2["text"] = "disable" #--Buttons b1 = Button(fenster, text="Button", height=5, width=7) b1.grid(row=0, column=0) b2 = Button(text="disable", command=switch) b2.grid(row=0, column=1) #copy the upper cody from stackflow and it's working but when i am going for same process in my project I am getting error on trace_add. Even I am not getting the code properly. Please reply
@BroCodez
@BroCodez 3 жыл бұрын
Do you have the textbox part of the code?
@anubhav4830
@anubhav4830 3 жыл бұрын
yes, the code I have provided you is perfect example how I want my button to work. You can copy and run it for better visualization. I didn't understand the code properly, so it will be helpful either you help me to understand the code or you can post any (video or code) in simple manner.
@BroCodez
@BroCodez 3 жыл бұрын
ok. that sounds difficult to do but I will research and see what I can find.
@Wallancey123
@Wallancey123 Жыл бұрын
Hi
@dreadcannibal3395
@dreadcannibal3395 2 жыл бұрын
the image doesn't work for me
@imihaita8913
@imihaita8913 Жыл бұрын
😆😆😆😍🥰😇
@Illya681
@Illya681 Жыл бұрын
image directory is not found error pls help
@prycereviews5690
@prycereviews5690 2 жыл бұрын
the count doesn't work for me nevermind
@ryce_jnes
@ryce_jnes 4 жыл бұрын
first to watch
@BroCodez
@BroCodez 4 жыл бұрын
Here ya go:🥇
@ryce_jnes
@ryce_jnes 4 жыл бұрын
can we be friends and share code when need
@KrewFams
@KrewFams 2 жыл бұрын
The back ground doesn't work
@bartekgrechuta7691
@bartekgrechuta7691 Жыл бұрын
hello
@damianplays4209
@damianplays4209 3 жыл бұрын
font dosn't work
@somyaranjanpatra4330
@somyaranjanpatra4330 3 жыл бұрын
Wows fantastic🤘😝🤘 code ya..
@guyincognito5614
@guyincognito5614 3 жыл бұрын
heres my comment
@tecaiii
@tecaiii 3 жыл бұрын
how do you make it so when you click the button once, it plays a sound?
@haha_urfunny8211
@haha_urfunny8211 3 жыл бұрын
I was wondering the same thing
@thecodeitworks5874
@thecodeitworks5874 3 жыл бұрын
he can you get me a download link to the image please
@BroCodez
@BroCodez 3 жыл бұрын
There isn't a download link for this. I used photoshop to increase the size of standard emojis ad saved as a .png : 👆
@thecodeitworks5874
@thecodeitworks5874 3 жыл бұрын
@@BroCodez ok thanks
@joshuahuang195
@joshuahuang195 Жыл бұрын
How do I do two commands at the same time?
@joshuahuang195
@joshuahuang195 Жыл бұрын
no, you can't do it
@joshuahuang195
@joshuahuang195 Жыл бұрын
?
@joshuahuang195
@joshuahuang195 Жыл бұрын
?
@joshuahuang195
@joshuahuang195 Жыл бұрын
why?
@joshuahuang195
@joshuahuang195 Жыл бұрын
because you can't do it
@Hdjekdndsmdkdkdndjehde
@Hdjekdndsmdkdkdndjehde Жыл бұрын
from tkinter import * window = Tk() window.title("Error Generator") window.geometry("1000x1000") window.resizable(False, False) def click(): window=Tk() window.title("Error!") button=Button(window,text="GenerateError") button.config(command=click) button.pack() window.mainloop().
Python GUI radiobuttons 🔘
12:22
Bro Code
Рет қаралды 22 М.
Tkinter Beginner Course - Python GUI Development
38:59
NeuralNine
Рет қаралды 493 М.
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 52 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 115 МЛН
Python buttons 🛎️
7:03
Bro Code
Рет қаралды 50 М.
PyGame Beginner Tutorial in Python - Adding Buttons
18:55
Coding With Russ
Рет қаралды 162 М.
Make Tkinter Look 10x Better in 5 Minutes (CustomTkinter)
4:40
TurbineThree
Рет қаралды 247 М.
Using button functions with arguments in tkinter
8:04
Atlas
Рет қаралды 15 М.
Python GUI windows 🖼️
8:07
Bro Code
Рет қаралды 63 М.
Python labels 🏷️
10:28
Bro Code
Рет қаралды 34 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,5 МЛН
Automate your job with Python
6:07
John Watson Rooney
Рет қаралды 377 М.
Python GUI colorchooser 🎨
6:36
Bro Code
Рет қаралды 12 М.
Tag her 🤭💞 #miniphone #smartphone #iphone #samsung #fyp
0:11
Pockify™
Рет қаралды 32 МЛН
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 7 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 1,7 МЛН
Как слушать музыку с помощью чека?
0:36
Samsung Galaxy Unpacked July 2024: Official Replay
1:8:53
Samsung
Рет қаралды 22 МЛН