@@anzhemeng8833 maybe make you entire functions reliant on an if statement that checks if the event x/y parameters its trying to push (aka mouse action) are outside the bounds that you dont want them to be, that should work, right?
Question: I get an AttributeNotExist -sort of error for label.startX and label.startY. I coulnd^t find any hints towards them in the documentation. What are the correct (new) names of these now?
I'm such a fan now, I truly hope you make a school of programming so I can throw my money at you. My own ambition at 36 years old is to become as dangerous as possible when it comes to programming. I comment some nonsense here, but that is purely to get UA-cam to put your content ahead of many others. Freecodecamp doesn't compare, I do however support their stuff as well.
Thank you so much for your lesson. You explained it very clearly and in detail. Revealing your motives for writing code. I wish you good health and creative success.
How would I save the new coordinates of the moved widgets so that when I close and rerun the program the widgets would be in the location I moved them last?
Hi. Thank you so much for creating python tutorials bro. ❤️ I have a question though. Why it's necessary subtract label.start from label.winfo? I mean we can do "drag and drop" without writing this. Can't we? Thank you in advance. 😍 Cheers. 🌹👍🏻
@@omairtech6711 This is very late, but i think this is the explanation, Everytime we move our mouse, we are creating a new coordinate, and our box is moving to that coordinate every time e.g (300,120) (2,49) (2,50) - My mouse moved down by 1 pixel so -> 120 - 49 + 50 300 121 - This is the new coordinate the box will move to
Hello Sir. Thank you for the tutorial. Could you make a tutorial follows this which implement drag and drop reorder functionality in a list in tkinter?
Umm... Excuse me, I'd like to ask what maybe the problem with my tkinter as I tried the code here but it made an Exception error and says that 'widget' is not defined once I tried to drag either labels. I checked both the code in the video and the code here in the comment and found nothing in mine that is any different. I do hope you'd be able to find this and help me. Thank you very much. :)
so is that true that we can create our own attribute for tkinter object ?? ( At 2:42 you said we can make our own attribute) But I guess it only works with tkinter right ??
@@BroCodez no you dont understand how much you just helped me without all the bullshit I have to endure from others. It is my priviledge to subscribe to straight and useful content.
from tkinter import *
def drag_start(event):
widget = event.widget
widget.startX = event.x
widget.startY = event.y
def drag_motion(event):
widget = event.widget
x = widget.winfo_x() - widget.startX + event.x
y = widget.winfo_y() - widget.startY + event.y
widget.place(x=x,y=y)
window = Tk()
label = Label(window,bg="red",width=10,height=5)
label.place(x=0,y=0)
label2 = Label(window,bg="blue",width=10,height=5)
label2.place(x=100,y=100)
label.bind("",drag_start)
label.bind("",drag_motion)
label2.bind("",drag_start)
label2.bind("",drag_motion)
window.mainloop()
Is it possible to confine the items in a certain area but they are still draggable?
@@anzhemeng8833 maybe make you entire functions reliant on an if statement that checks if the event x/y parameters its trying to push (aka mouse action) are outside the bounds that you dont want them to be, that should work, right?
can we make thew widgets drop to only the coordinates we want?
I don't understand this x = widget.winfo_x() - widget.startX + event.x
Can you explain this please?
Superb explanation. I am taking up coding after a gap of 11 years and these tutorials are of extreme help.
OK, this is an amazing intro to building a drag-and-drop GUI in Python. I can't believe how EASY it looks! Thank you for posting this!!
I took 5 min to understard the algorithm you use to drag and drop. It relates to vectors which I love at mathematic. Thanks you for teaching!
I still don't really understand it LOL.
Could you pls explain me the algorithm...?
Question: I get an AttributeNotExist -sort of error for label.startX and label.startY. I coulnd^t find any hints towards them in the documentation. What are the correct (new) names of these now?
Explanation very good with a lot of details. Kudos!!!
Eu amo tkinter...
Agora, a realidade pode ser o que eu quiser
Muito obrigado, ajudou demais
Bro, again you made Python the best alternative for any new programmer. 😎👏
thanks Mon Wil!
Excellent training session. Thank you.
P.S. May want to make this a series on DnD. Next maybe Dragging from a menu bar and Dropping in the work area.
Great presentation! Concise, clear and easy to follow.
I'm such a fan now, I truly hope you make a school of programming so I can throw my money at you. My own ambition at 36 years old is to become as dangerous as possible when it comes to programming. I comment some nonsense here, but that is purely to get UA-cam to put your content ahead of many others. Freecodecamp doesn't compare, I do however support their stuff as well.
Bro! Thank you so much! Great tutorial! Simple, easy clean, easy to follow with no extra fluff! SUBSCRIBED!
Sir I have questions.
How to change only selected label size use of mouse if you have multiple label please reply
step 3 = done
step 1 = done 👍
step 2 = done 🗯
thank you very much Bro!
THIS IS AWESOME. can you also make the whole window move when the root.overrideredirect is 0.
Thank you so much for your lesson. You explained it very clearly and in detail. Revealing your motives for writing code. I wish you good health and creative success.
I got a problem whhere unresolved attribute reference 'startX' for class 'Label' bro, python 3.10 ver here help me
i appreciate the briefing but like some details as well
Superb. Thank you.
Nice brooo
perfect tutorial. Thanks a lot sir
How would I save the new coordinates of the moved widgets so that when I close and rerun the program the widgets would be in the location I moved them last?
nice one bro...love it
Hi.
Thank you so much for creating python tutorials bro. ❤️
I have a question though.
Why it's necessary subtract label.start from label.winfo?
I mean we can do "drag and drop" without writing this. Can't we?
Thank you in advance. 😍
Cheers. 🌹👍🏻
I am interested in an answer to this as well.
i think it is so because you have to shift the label to the left to maintain its original position
@@omairtech6711 This is very late, but i think this is the explanation,
Everytime we move our mouse, we are creating a new coordinate, and our box is moving to that coordinate every time e.g
(300,120) (2,49) (2,50) - My mouse moved down by 1 pixel
so -> 120 - 49 + 50
300 121 - This is the new coordinate the box will move to
@@Frosturus Thanks. I will watch the video again when ever I get time and then try to understand what you are saying.
@@omairtech6711 ok cool! If you need me to explain it a different way, just let me know!
Hi, i want to know if you can put collisions in the label(red and blue square for make them hit between itselfs)?
Thanks Bro, great tutorial!
Please , do more video about python
No need to be come a bro, thank you. But I appreciate the video all the same. Well done.
Excellent! Thank you!
Perhaps the title is a little misleading
I was expecting drag and drop from a palette into a frame
That kind of drag and drop
Hello Sir. Thank you for the tutorial.
Could you make a tutorial follows this which implement drag and drop reorder functionality in a list in tkinter?
Thank you for your help:)
thanks, that was even for me totally clear
Umm... Excuse me, I'd like to ask what maybe the problem with my tkinter as I tried the code here but it made an Exception error and says that 'widget' is not defined once I tried to drag either labels. I checked both the code in the video and the code here in the comment and found nothing in mine that is any different. I do hope you'd be able to find this and help me. Thank you very much. :)
Great Video!
wonderfully explained
thank you king
👑
Great 👍
Cool
Thank you sooooooo much!!
Thank You!
❤
عالی
Thank you Bro!
😊👍Excelente
very good
thanks for watching Dimitrios
Is there any way to do the same without the window? Drag and drop it the screen
That may be possible with the tkinter.dnd module.
Thanks for question, that would be a good topic for a video
@@BroCodez Would be great. ty
Wow 💯%
Thank you
TY BRO
Buenísimo!
Is there any programs like Visual Basic i.e Drag and Drop. Python just has too much coding!
try C++ or Java
hello.my friend thank you !
thanks for watching Isaie!
think you
so is that true that we can create our own attribute for tkinter object ?? ( At 2:42 you said we can make our own attribute)
But I guess it only works with tkinter right ??
nice!
Bro...
Thanks!
thanks for watching 3dw
@@BroCodez no you dont understand how much you just helped me without all the bullshit I have to endure from others.
It is my priviledge to subscribe to straight and useful content.
2k 👏👏👏
We did it! 2k
this one was difficult
meow meow moew~!
Hi! is there any way you can do it without importing Tkinter?
no
Why isn't this code running 😭😭
comment