#πŸ”’ I would like to change the selectedSAMPLE's value...

18 messages Β· Page 1 of 1 (latest)

nova bramble
#

im at the stage of making sure the value of selectedSAMPLE changes from None to the sample I just made/clicked. I printed the variable for checking and I keep getting None no matter what I click.
Anyways, here's my code:
https://paste.pythondiscord.com/SFXA

foggy wadiBOT
#

@nova bramble

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.

pallid cipher
#

If you want to change the global x variable, you need to add a global declaration

def my_func():
    global x
    x = 1
lethal cloud
#

in general don't use global, it makes your code hard to read and debug, and causes all sorts of issues that are challenging to debug unless you have mastered python already and are capable of explaining in detail why global is ok in this specific instance.

grave sphinx
#

command = lambda x=selectedSAMPLE: select(x) is None, so every button will get None as the default argument. Even if/when you make changes to it later, it'll always be None.

pallid cipher
#

also that

nova bramble
grave sphinx
nova bramble
#

i want to make it update the variable and i dont know how to

grave sphinx
# nova bramble i want to make it update the variable and i dont know how to

https://youtu.be/mop6g-c5HEY This is a long video, but a lot of it is making different apps. The first hour or so goes over all the basics, with variables... getting and setting widgets, passing arguments to lambda functions... all which you're stuck at right now.

This tutorial covers everything you need to know about user interfaces in Python. I will go over all of tkinter, Python's default GUI framework, cover all the basics and then create a BMI app, a calculator and a photoshop style image editor.

If you enjoy this course, consider buying the tutorial that covers 7 additional apps: A responsive weat...

β–Ά Play video
nova bramble
grave sphinx
#

Yeah, ctk just wraps tk, with some improvements.

pallid cipher
#

the video does actually use customtkinter

foggy wadiBOT
#
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.