#๐ Suggestions for improvement of code..
12 messages ยท Page 1 of 1 (latest)
@peak steppe
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.
Closes after a period of inactivity, or when you send !close.
You can eliminate your try/except if you just leave your input as a string
just because something is a digit doesn't mean it has to be int
understood
match option:
case 1:
get_screen_size()
case 2:
get_current_mouse_pos()
case 3:
close_current_window()
case 4:
take_screenshot()
case 5:
minimize_all()
case 6:
mouse_pos_logger()
case 7:
open_notepad()
case 8:
copy_paste()
case 9:
click_at_pos()
case 10:
type_random_pwd()
``` u can put all these functions into a list, and then use `option` to index it:
```py
# note that we aren't using the '()' after the function name here
myfuncs = [get_screen_size, get_current_mouse_pos, ...]
while option in range(1, 11):
target_function = myfuncs[option - 1] # since option starts at 1, but lists are 0-indexed
target_function()
myfuncs = [get_screen_size, get_current_mouse_pos, ...]
while option in range(1, 11):
target_function = myfuncs[option - 1] # since option starts at 1, but lists are 0-indexed
target_function()
``` dont understand one thing here..
oh nvm
thanks for the tips!
!close
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.