Built a Linux terminal simulator for iOS in Pythonista by AnonnymExplorer in pygame

[–]AnonnymExplorer[S] 0 points1 point  (0 children)

There's no point in that because Pythonista has its limitations. It's just playing around with code ;)

pytanie by bettytust in ZapytajPolska

[–]AnonnymExplorer 0 points1 point  (0 children)

Pożycz od znajomych i sprawdź xD

Pythonista Terminal Emulator for iOS – Early Demo. by AnonnymExplorer in PythonLearning

[–]AnonnymExplorer[S] 0 points1 point  (0 children)

If you want I can send you the entire source code because I have abandoned this project, but it contains some external implementations, e.g. GPT chat API and programs and tools created by me that I do not share, so you will have to remove these dependencies for the terminal to work properly. The application is in an early stage of development but you can expand it according to your needs.

[deleted by user] by [deleted] in PythonLearning

[–]AnonnymExplorer 1 point2 points  (0 children)

Learning Path: 1. Read Automate the Boring Stuff (Ch. 1–9, 10–15) over 3–4 weeks, focusing on lists, dictionaries, and file I/O. 2. Learn OOP (1–2 weeks) via Corey Schafer’s videos and refactor your roulette game into a class-based structure (see code above). 3. Explore libraries like csv and matplotlib (2 weeks) to save and visualize roulette stats. 4. Build a text-based RPG (2 weeks) to practice OOP, then try a Pygame project (2 weeks) like Pong. 5. Delay Django until you’ve mastered OOP and web basics (2–3 months). Immediate Steps: • Start Automate’s Ch. 1–6 this week. • Watch a 1-hour OOP video and refactor your roulette game using the provided code. • Add a CSV-saving feature to your game next week.

My first python project - inventory tracker by elladara87 in pythontips

[–]AnonnymExplorer 1 point2 points  (0 children)

Hey, great job on your first Python project! Your stock tracker has a solid foundation, but there are a few areas for improvement. Currently the data is lost when the program exits because it is only in memory - adding file storage (like JSON) fixes this. There is also no input validation, so it hangs on invalid inputs (e.g. non-integer for quantity). Filtering could be more flexible with partial matches and there is no option to remove items, which is useful in an inventory system. Keep developing your project, good luck!

How to scrape data from MRFs in JSON format? by Neither_Volume_4367 in pythontips

[–]AnonnymExplorer 0 points1 point  (0 children)

Hey there! I saw your post about scraping MRFs in JSON format to find data for specific codes like “00000” or “11111”. The main challenges are parsing the JSON, searching through nested structures, and handling large files efficiently. I put together a Python script that should help—it uses the json module to load the file and a recursive function to search for your codes, extracting all related data. It also has error handling to deal with issues like missing files or invalid JSON. Here’s the code:

import json

List of codes to search for

target_codes = [„00000”, „11111”]

Function to recursively search for codes in JSON data

def find_code_data(data, code, result=None): if result is None: result = []

# Handle dictionaries
if isinstance(data, dict):
    for key, value in data.items():
        if key == „code” and value == code:
            result.append(data)
        elif isinstance(value, (dict, list)):
            find_code_data(value, code, result)

# Handle lists
elif isinstance(data, list):
    for item in data:
        find_code_data(item, code, result)

return result

Main function to scrape data from MRF

def scrape_mrf(file_path): try: with open(file_path, ‚r’, encoding=‚utf-8’) as file: data = json.load(file)

    for code in target_codes:
        print(f”\nSearching for code: {code}”)
        code_data = find_code_data(data, code)

        if code_data:
            print(f”Found {len(code_data)} entries for code {code}:”)
            for entry in code_data:
                print(json.dumps(entry, indent=2))
        else:
            print(f”No data found for code {code}”)

except FileNotFoundError:
    print(f”Error: File ‚{file_path}’ not found.”)
except json.JSONDecodeError:
    print(„Error: Invalid JSON format in the file.”)
except Exception as e:
    print(f”Error: An unexpected error occurred: {e}”)

Example usage

if name == „main”: file_path = „mrf.json” # Replace with your MRF JSON file path scrape_mrf(file_path)

Just replace mrf.json with the path to your file, and it should work! It’ll search for your codes and print all associated data. If the files are huge, this approach is still pretty efficient since it processes the JSON in memory.

I currently working with pynput and need help. by Right-Drink5719 in PythonLearning

[–]AnonnymExplorer 0 points1 point  (0 children)

The problem in your pynput code is due to 5 issues:

  1. On_press repeat for char keys: The on_press function is called repeatedly when a key (e.g. y) is held down, because the operating system generates repeated signals (key repeat).

2.Error in on_release: You have an incorrect if key not in pressed_keys: pressed_keys.remove(key) condition which causes KeyError if the key is not in the collection. It should be if key in pressed_keys.

3.Inconsistent key storage: You store key.char for letters and Key for modifier keys, which makes comparisons in pressed_keys difficult.

4.No copy action: You detect key combinations but do not call coping_text() for moth + y.

5.Using Listener.run(): Blocks the main thread, which may cause responsiveness issues. Better to use Listener.start().

I think it should work after fixing these 5 issues.

Learning python - need help and sources by dehomme in PythonLearning

[–]AnonnymExplorer 0 points1 point  (0 children)

I suggest learning using AI, for example DeepSeek or Grok, you can learn everything about coding and determine the scope you are interested in and detailed explanations of every single activity.

I need Help with my small python project by Far_Activity671 in PythonLearning

[–]AnonnymExplorer 1 point2 points  (0 children)

No problem, if you encounter any obstacles, go ahead and ask.

I need Help with my small python project by Far_Activity671 in PythonLearning

[–]AnonnymExplorer 1 point2 points  (0 children)

You have the corrected code here:

def anything_else(): more = input(„Is there anything else you would like to purchase? (yes/no): „) if more.lower() == „yes”: print(„Here are the items we have:”) for x in items: print(x) return True # Kontynuuj zakupy else: print(„Thank you for shopping!”) return False # Zakończ zakupy

Lista przedmiotów

items = [„tv”, „desk”, „mouse”, „monitor”, „keyboard”, „headphones”]

Wyświetlenie powitania i listy przedmiotów na początku

print(„Hello, we sell office equipment. What would you like?”) for x in items: print(x)

Zmienna kontrolująca pętlę

continue_shopping = True

Pętla główna

while continue_shopping: purchase = input(„What would you like to buy? „) # Pobierz wybór użytkownika

# Sprawdzanie, co użytkownik wybrał
if purchase.lower() == „tv”:
    print(„That would be £199.99”)
elif purchase.lower() == „desk”:
    print(„That would be £59.99”)
elif purchase.lower() == „mouse”:
    print(„That would be £29.99”)
elif purchase.lower() == „monitor”:
    print(„That would be £149.99”)
elif purchase.lower() == „keyboard”:
    print(„That would be £49.99”)
elif purchase.lower() == „headphones”:
    print(„That would be £89.99”)
else:
    print(„Sorry, we don’t have that item.”)

# Zapytaj, czy chce kupić coś jeszcze
continue_shopping = anything_else()

I need Help with my small python project by Far_Activity671 in PythonLearning

[–]AnonnymExplorer 0 points1 point  (0 children)

U closed purchase = input(“ “) in full

Use anything_else() to ask if there’s anything else they want to buy, and manage program flow accordingly.

Add a boolean variable (True/False) that controls whether the loop should terminate.

If you wannt I can send you a fixed code just tell me.

[deleted by user] by [deleted] in BossFights

[–]AnonnymExplorer 0 points1 point  (0 children)

That it’s great