#๐ settings button only executes code when initalizing the app and never when you click it
122 messages ยท Page 1 of 1 (latest)
@hollow dagger
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.
I would guess the about button isn't working too?
in fact I think all the buttons are not working for different reasons
what I would try is:
MainApp.SettingsButton.clicked.connect(lambda: self.SettingsMenu())
but I'm not sure about the documentation for the .clicked.connect function
Likewise
GlobalVars.buttonA.clicked.connect(lambda: ButtonClicked("A"))
@hollow dagger did you figure it out?
whats the lambda for
thats running a function upon click
you need to pass in a function
i never had to do that
what were you using before?
that exact command
about button and settings button works
the buttons inside the settings menu dont
gimme a second, looking up an old project
self.ui.nav_home_button.clicked.connect(self.nav_button_click)
this is the format i used
yes
let me take al ook at your code again
i also need some help btw๐
get your own channel
GlobalVars.buttonA.clicked.connect(ButtonClicked("A"))
GlobalVars.buttonC.clicked.connect(ButtonClicked("C"))
GlobalVars.buttonB.clicked.connect(ButtonClicked("B"))
these are wrong
have you tried the lambda trick
lemme try it
put it in a function, so that there's something to call
ok i changed them to lambdas
WHAT KIND OF BLACK MAGIC SORCERY WAS THAT
then the settings button worked the first time
IT WOKRD
but iti snt for the second because ....
Traceback (most recent call last):
File "c:\Users\Bilal\python discord\cordless\main.py", line 171, in SettingsMenu
Settings.__init__(self)
File "c:\Users\Bilal\python discord\cordless\main.py", line 231, in __init__
Settings.Layout.addWidget(GlobalVars.buttonA)
RuntimeError: Internal C++ object (PySide6.QtWidgets.QPushButton) already deleted.
key error 7
so lets take al ook at this
yeah that's probably a different problem
you want to perform your action later, so you need to give a function that the code can call at the time it needs to call
if you just run the function now, you aren't getting the behaviour later
my brain doesnt understand lol
Lord Garmadon magic
It's the difference between
x = print("hello world")
# and
y = lambda: print("hello world")
In the first case x is None and it prints instantly.
In the second case y is a lambda and it prints when you call y()
you want the "it prints later" behaviour so you gotta put it in a lambda
ok
so i cant open the settings menu a second time bc it just deltes a c++ object
i never had this issue
this is my first project with ti
well yeah there you go
but i had it running perfectly before i switched the config file to json
its a much more mature library than tkinter imo so you have to change how your program
ah
Settings.Layout.addWidget(GlobalVars.buttonA)
so you need to make another button
not use ones that youve used elsewhere
i think thats the main issue
maybe i need to define the button in settings .init
mmm
bc when i close the window it destorys evrey thing inside the window
i was only using thoes buttons for the settings menu
about a week lol
i can share you a youtube video i used a while ago to try to teach myself pyside
oh ok great
one sec
Beautifully animated side menu desktop app interface in Python, PySide, PyQt, and QT Designer.
The source code is available for everyone to download.
Download the full source code here(Without UI file): https://www.spinncode.com/designs/GRgxnBL4
Full Source Code With UI File:
https://www.patreon.com/posts/51228254
FREE ICONS DOWNLOAD
https://...
make a new project and run through this separately
animating pyside dang
does it use pyside 6 or 5
bc i run kde 6 and would prefer pyside 6
i dont wanna use a designer
oh okay
i mean you can add that functionality later
true
im just saying, look through this, follow it, there may be some slight differences between 5 and 6
but it should still work
it shoulve updated when i switched to plasma 6
oh wait thats just addons
ye
should be there with just pyside6
i have the pyside 6 library bc KDE my Desktop Enviroment depends on QT6
neat
now there is ligit only one issue left
key error 7
in the json
its saying there is no key "7" but there is
do you mind if i send you a freind rq
sure i can help when i have time
ye but also to have someone to show off my code to
also im not getting that key error after putting in those lambdas
as many people in my life tune out when i start talking about the app i made
they dont know the work it takes ๐
But they also have other things on their mind im sure
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.