#๐Ÿ”’ Gui

50 messages ยท Page 1 of 1 (latest)

tawdry surgeBOT
#

@idle bronze

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.

stray palm
#

tkinter

#

or pyqt or pygame

#

are python libraries for ui

scenic light
#

Do you know how to make rock paper scissors without gui?

#

Sure!

stray palm
#

I think pygame is probably the best for this as its built to make games and it considered easy for beginners

scenic light
#

tkinter would 100% be the simplest for a rock paper scissors game

#

You can't upload files here. You'll have to use this paste link

#

!paste

tawdry surgeBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

scenic light
#

Before handling the GUI, the first thing I would do is split your game logic into more specific functions. GUI is ultimately a window that will call functions for you at specific times

stray palm
#

he said gui

scenic light
#

for example, write a function that takes in two options of rock/paper/scissors and returns the winner

#

yes, tkinter is a GUI

#

GUI just means a visual window instead of terminal

#

Yes. Your functions are quite large and multi-purpose

#

I'm saying to split it into more specific functions

#

tkinter is definitely the simplest and more user friendly

#

but I'm saying that all GUI does is display already written code, and if your code is not written in a specific way, the GUI won't be able to understand it

#

Instead of using input(), you would use buttons

#

instead of print(), you would use labels

#

you need functions that can accept this data and return results so you can properly display them in the gui

#

you have to write them yourself

#

.rp tkinter

stuck mossBOT
#

Here are the top 5 results:

Python GUI Programming With Tkinter
Build a Tic-Tac-Toe Game With Python and Tkinter
Bypassing the GIL for Parallel Processing in Python
Python sleep(): How to Add Time Delays to Your Code
Arduino With Python: How to Get Started
scenic light
#

There's a good intro to tkinter here

stray palm
#

tkinter is builtin in python

#

so you don't have to download anything

#

it's a library

#

which is builtin

#

like math or time

scenic light
#

it doesn't matter what editor you use, tkinter is part of python

#

module is a fancy name for a python file that you import

#

library is a collection of modules

#

framework is usually a more established way of interacting with another existing feature, like a framework for writing code that interacts with web

#

yes, that's all it is

#

when you import random, you're importing a python file named random.py

#

!e

import random

print(random)
tawdry surgeBOT
scenic light
#

no

#

that's just an "alias"

#

you're changing the namespace of an imported module

stray palm
#

yes, you can have your own my_module.py and import things from there

#

yes withut the . py

#

import bip

tawdry surgeBOT
#
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.