#๐Ÿ”’ how do i add a image title instead of just a title? im just 13 years old im new to this pls help.

14 messages ยท Page 1 of 1 (latest)

earnest pendantBOT
#

Hey @half lagoon!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
#

@half lagoon

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.

half lagoon
#

@small saffron

#

pls help

#

import tkinter as tk

def play_button_clicked():
# Define the action to be performed when the play button is clicked
print("Play button clicked!")

# Destroy all widgets
for widget in root.winfo_children():
    widget.destroy()

Create the main window

root = tk.Tk()
root.title("Play Button UI")

Get the dimensions of the main window

window_width = root.winfo_screenwidth()
window_height = root.winfo_screenheight()

Set the geometry of the window

root.geometry(f"{window_width}x{window_height}")

Create a canvas to draw the textured background

canvas = tk.Canvas(root, width=window_width, height=window_height)
canvas.pack()

Create a textured background

for i in range(0, window_width, 20):
for j in range(0, window_height, 20):
if (i + j) % 40 == 0:
canvas.create_rectangle(i, j, i + 20, j + 20, fill="lightgray", outline="")

Create the title label and place it on the canvas

title_label = tk.Label(root, text="Welcome to the Game", font=("Arial", 32), bg=canvas["bg"])
canvas.create_window(window_width // 2, window_height // 4, window=title_label)

Define a custom font for the play button

play_button_font = ("Helvetica", 20, "bold")

Create the play button and place it on the canvas

play_button = tk.Button(root, text=" Play ", command=play_button_clicked, font=play_button_font)
canvas.create_window(window_width // 2, window_height // 2, window=play_button)

Run the Tkinter event loop

root.mainloop()

dusk rapids
earnest pendantBOT
#
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.

tardy flare
#

thats a better way to explain it

#

i was trying to look for that

#

i dont really understand what he is trying to ask though from the tittle

dusk rapids
#

This part

#Create the title label and place it on the canvas
title_label = tk.Label(root, text="Welcome to the Game", font=("Arial", 32), bg=canvas["bg"])
canvas.create_window(window_width // 2, window_height // 4, window=title_label)

It's currently a text title. OP wants to place an image as the title.

#

I've no clue. Not a tkinter expert

earnest pendantBOT
#
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.