#๐Ÿ”’ What does this error mean and how do I fix it?

29 messages ยท Page 1 of 1 (latest)

cursive sigil
#

import tkinter as tk

root =tk.Tk()
root.title("d draw")

canvas = tk.Canvas(root, width=400, height=400, bg="white")
canvas.pack(fill="both", expand=true)

def paint(event):
x1, y1 = (event.x - 1,), (event.y - 1)
x2, y2 = (event.x + 1,), (event.y + 1)
canvas.create_oval(x1, y1, x2, y2, fill="black", width=5)

canvas.bind("<B1-Motion>" , paint)

root.mainloop()

vital hedgeBOT
#

@cursive sigil

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.

slender hawk
#

After declaring the function u must indent the rest of the code that is supposed to be in the function

drowsy ether
hearty dagger
#

first, use syntax highlight for better reading

#

!code

vital hedgeBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

cursive sigil
#

Okay what lines do i Indent

#

how many indents

hearty dagger
cursive sigil
#

Thanks also what do I do for this

hearty dagger
#

after declaring function you need to use tabs like this

def paint(event):
    x1, y1 = (event.x - 1,), (event.y - 1)
    x2, y2 = (event.x + 1,), (event.y + 1)
    canvas.create_oval(x1, y1, x2, y2, fill="black", width=5)
#

also in line 9 true should be True

#

That's basic syntax

hearty dagger
#

I suggest you going learning basic python syntax before coding. That's useful.

cursive sigil
#

I'll make sure to do that after this

#

How do I define the x1 and x2 commands

hearty dagger
cursive sigil
#

I meant objects

hearty dagger
#

eeh

#
x1 = something
x2 = something
#

I'm sorry if I didn't understand your question correctly

cursive sigil
#

Thanks I'm trying to make a drawing app. So I want x and y To do things that they would need to do with a drawing app

vital hedgeBOT
#
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.