#๐Ÿ”’ Can anyone help me?

37 messages ยท Page 1 of 1 (latest)

silk raftBOT
#

@supple geyser

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.

spark pawn
#

@supple geyser I recovered your message

I have a script that should create buttons. When I click on the created button, a file selection menu should open. After selecting a file, when I click the button again, the selected file or folder should open. And all this should be saved and not reset on reboot. But when I click the button, nothing happens. I would appreciate it if you could help me.

#

You can't upload files here. If you want to share your code, use a pastelink

#

!paste

silk raftBOT
#
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.

supple geyser
#

Can anyone help me? I have a script that should create buttons. When I click on the created button, a file selection menu should open. After selecting a file, when I click the button again, the selected file or folder should open. And all this should be saved and not reset on reboot. But when I click the button, nothing happens. I would appreciate it if you could help me.

spark pawn
#
if button_id not in button_files:
spark pawn
#

you're checking if the button_id is in your button_files, which it always will be

#
button_files[button_id] = None 
#

you do this when you add your button

#

using in with a dict checks if the key exists, it doesn't matter what the value is

#
if button_files.get(button_id) is None:
#

this would be a better condition to check for when you click the button

supple geyser
#

Sorry, I'm just starting out and I'm also a Python programmer, so can you just drop the part of the code that I need to replace? I'll figure out what the guy says in it and what my problem is. I'd be very grateful.

spark pawn
#

I just did

spark pawn
supple geyser
#

instead of This is it "button_files[button_id] = None" this is it "if button_files.get(button_id) is None:"

#

?

spark pawn
#

No, that part is correct

#

replace the condition that you have with the adjustment I made

#

I was showing you why your first condition doesn't work correctly

supple geyser
#

if button_id not in button_files: change to if button_files.get(button_id) is None:

#

?

spark pawn
#

yes

supple geyser
#

Thank you very much, I spent the whole day today on this and couldn't fix it. And it was such a small mistake.

#

and can you also tell me how you make a frame like this

#

And how can I make it so that when I run the program again, everything goes back to how it was?

spark pawn
#

!code

silk raftBOT
#
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.

spark pawn
#

There's still some logic issues with how you're storing the information of the button which won't allow you to save. You're trying to use your button id, but your button ids are out of sync

#

One possible solution is you can create another dict to store the button widgets and their associated IDs

supple geyser
#

can you tell me how to create it

silk raftBOT
#
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.