#๐Ÿ”’ Need help in my code can anyone fix it

31 messages ยท Page 1 of 1 (latest)

lusty nova
#

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)
screen = Tk()

screen.attributes('-fullscreen',True)

label = Label(screen,bg="red",width=10, height=4)
label.place(x=0,y=0)

label2 = Label(screen,bg="blue",width=10, height=4)
label2.place(x=100,y=100)

label.bind("<Button-1>",drag_start)
label.bind("<B1-Motion>",drag_motion)

label2.bind("<Button-1>",drag_start)
label2.bind("<B1-Motion>",drag_motion)

screen.configure(background="black")
background_image = PhotoImage(file='bg1.png')
background = Label(screen, image=background_image)
background.pack()

screen.mainloop()

i hve added the image you will need

balmy wyvernBOT
#

@lusty nova

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rain grotto
#

fix what?

untold sonnet
lusty nova
#

run the code firsr

pastel acorn
#

can you say what the problem is ?

lusty nova
#

press alt+F4 to exit

pastel acorn
#

then ?

untold sonnet
lusty nova
#

a made a background as a label and i made another label and the other label overlaps the bg

pastel acorn
#

there is a red and a blue box

#

behind the bg

#

can you tell your problem all at once

lusty nova
#

not sure why that was happening

versed light
#

put your background label before your blocks

#

Works for me

lusty nova
#

the blue and red boxes are suppost to be drag and drop

lusty nova
versed light
#

Everything works fine for me

lusty nova
#

there are suppose to be on the bg

versed light
#

wdym?

lusty nova
#

something of apps on a computer screen

versed light
#

You want this?

lusty nova
#

t just tested is don't worry i fixed the error when i tried putting the label behind the bg ins ted of butting the bg before the label i put the label in the screen config

#

the problem is fixed

lusty nova
nimble crag
lusty nova
#

!solved

balmy wyvernBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.