#🔒 game

14 messages · Page 1 of 1 (latest)

glass arch
#

Hi, can someone help me make a game in Pygame? I use Python 3.11.4

neon totemBOT
#

@glass arch

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.

quartz sundial
#

What help do you need? What have you tried? What are you having problems with?

glass arch
#

import random
import tkinter as tk

class GraZgadnij:
def init(self, master):
self.master = master
self.liczba = random.randint(1, 10)
self.proba = 0

    self.frame = tk.Frame(master, bg="#1e1e1e")
    self.frame.pack(pady=20)

    self.label = tk.Label(self.frame, text="Zgadnij liczbÄ™ od 1 do 10", fg="white", bg="#1e1e1e")
    self.label.pack()

    self.entry = tk.Entry(self.frame)
    self.entry.pack(pady=5)

    self.button = tk.Button(self.frame, text="Sprawdź", command=self.sprawdz)
    self.button.pack(pady=5)

    self.output = tk.Label(self.frame, text="", fg="yellow", bg="#1e1e1e")
    self.output.pack()

def sprawdz(self):
    self.proba += 1
    try:
        guess = int(self.entry.get())
    except:
        self.output.config(text="Wpisz liczbÄ™!")
        return

    if guess < self.liczba:
        self.output.config(text=f"Za mało! Próba {self.proba}")
    elif guess > self.liczba:
        self.output.config(text=f"Za dużo! Próba {self.proba}")
    else:
        self.output.config(text=f"Brawo! Trafiłeś w {self.liczba} po {self.proba} próbach!")
        self.entry.config(state="disabled")
        self.button.config(state="disabled")

if name
root = tk.Tk()
root.title("Gra: Zgadnij liczbÄ™")
root.geometry("300x200")
app = GraZgadnij(root)
root.mainloop()
I'm sorry that it is written in Polish

neon totemBOT
#
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.

quartz sundial
#

Also, you're using tkinter, not pygame... Which one do you need help with?

glass arch
#

thank you Leandro Vandari

pulsar pebble
#

i'd look up pygame tutorial on yt

#

Thanks to Brilliant for the support, you can find them here: https://brilliant.org/ClearCode/

This video covers game development in Python. We will create a spaceship shooter, a Vampire survivor style game, Pong, a platformer and a Pokémon inspired battle game. Via those you can master your knowledge of Python since we will touch on every par...

â–¶ Play video
#

this is what im planning on doing

neon totemBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.