Python and Tkinter: Adding Buttons and the Pack Method

preview_player
Показать описание
Advanced Python Programming Tutorials! Check out my latest series on Tkinter GUI with Python. In this video I'll be adding buttons to our Tkinter GUI and I'll be explaining how to position items in our window with the pack method!

♦♦♦♦♦♦♦♦♦♦

THECODEX is a company focused on empowering and enabling anyone to learn how to code. Established in 2015 by Avinash Jain, THECODEX has taught over 600,000 students around the world how to code. With over 16 programming courses on a wide variety of topics, and more than 20,000 5-Star reviews, THECODEX is the right choice for you.

We provide engaging and comprehensive videos that break down complex information and cover everything you need to know about the subject. All students get access to our Q/A forums where you can get your doubts and problems cleared up. At the end of every course, you will receive a certificate of completion.

Jumpstart your Coding Journey with THECODEX today!

♦♦♦♦♦♦♦♦♦♦

Music: Flash Funk (Marshmello)
Рекомендации по теме
Комментарии
Автор

bro, i dont know who are you but you are really good. i was really confused for this thing!! but thanks to you, you make my concepts clear. i love your way to explain. Really awesome, your energy, activeness and literallly everything!!

pranavgoswami
Автор

Very useful tutorial. Sir can you explain -How to create clickable buttons to control gpio pins of microcontroller to use it on an iot project??
I want to learn it. Please 🙏

anokhautomation
Автор

Great video.  I am using the Raspberry Pi(3) and the Rock64. Thanks.

qzorn
Автор

How do I get the text the button outputs into the button program

ryderstover
Автор

is there a way to fix background layer

MathematicalReasoning
Автор

Any way we can execute two commands with button (or buttons) at the same time

sanatasneem
Автор

so you said Button is an object 2:19 but i believe that Button is an (init) class and the (b) is the object that you've created from that class, and the pack() is a function of the class (Button), so because the - b - is an object from that class you can call any function in the class like pack but in this case you have to call it. fix me if I'm wrong

Czoy
Автор

im using this with pygame but it opens a seperate windows for the buttons on white background but not appears on my game window. can someone please help

divide
Автор

When we use side = left why all buttons comes to middle of the screen ? I want all buttons up and in one row how can i do it?

akashdeepgupta
Автор

cant we use lambda instead of defining a function like in the last tutorial??#help

jenishshrestha
Автор

I’ve created a button, with a command. But when I click the button the command doesn’t seem to be executed ? - the command is to pack a new text but when I click the button no new text is added. I’m using a Mac Pro

sliceoflemon
Автор

How do you redirect the code to another code depending on the click on button 1 or button 2?

paulmalagoli
Автор

b = Button(pencere, text="Click me!")
TypeError: __call__() got an unexpected keyword argument 'text'


how can i fix that ?

FurkanVeOyunn
Автор

I can't change color in the Button. With my Mac is impossible. Can you help me?

fabrizioconversazioni
Автор

It's an error ...which is . Name error : name 'Lable ' is not defined
PL help me

nimaldayarathne
Автор

what if i want to display the output hello word on my window when button is triggered

harshithyerra
Автор

I changed it up a little

from tkinter import *

root = Tk()
root.geometry('300x300')

l = Label(root, text="Click to get a idiot point")
l.pack(side=LEFT)

def buttonFunction():
print("You got an idiot point")

def Buttonfunction():
print("You got a smart point")

b = Button(root, text="Click me to get idiot points", command=buttonFunction)
b.pack(side=LEFT)

b2 = Button(root, text="Click me to get smart points", command=Buttonfunction)
b2.pack(side=RIGHT)

root.mainloop()

unbreakable