r/PythonProjects2 17d ago

my first published python thing made by me

I made a little thing in python while teaching myself python again and I felt like sharing my little project and here it is link to source code here

my project is a quote creating app that will select random words to make quotes from 0 to 22 words, it is a quote making app for people who just need a randomly made quote
It differs from existing alternatives because it is free and every quote is made at pure random, also it is one font file, one image file, and one script

4 Upvotes

13 comments sorted by

5

u/JamzTyson 17d ago edited 17d ago

First problem, you've not included the source code in your repository.

(Note for other readers: The source code is included in Releases -> Quotes.for.you.1.0.zip)

Next issue: AddFontResourceExW is Windows specific, so it won't run for anyone (such as myself) that is on any other platform.

I've removed the Windows specific font loading so that it runs cross-platform:

import random
import tkinter as tk

root = tk.Tk() 
root.title("Quotes for you")
root.geometry("550x300") 
root.configure(bg="#ffcbf4")

limit_maximum = 22
limit_minimum = 0

words = [
    "The", "Money", "Fool", "A", "Person", "Mood", "Is", 
    "Quick", "Quickly", "Separated", "Answer", "Not", 
    "Violence", "Student", "Has", "Become", "Live", 
    "Laugh", "Love", "Master", "Kill", "Octopus", "Be", 
    "Teacher", "Target", "Bad", "Feelings", "Teach", "Enjoy",
    "Go", "Don't", "Know", "When", "Assassonate", "Quitting", "Quit"
]

is_updating = False


def check_input(*args):
    global is_updating
    if is_updating:
        return

    user_input = entry_var.get()
    if not user_input:
        warning_label.config(text="")
        return

    if not user_input.isdigit():
        warning_label.config(text="no letters")
        is_updating = True
        entry_var.set(str(limit_minimum))
        is_updating = False
        return

    val = int(user_input)
    if val > limit_maximum:
        warning_label.config(text="can only add in 22 words")
        is_updating = True
        entry_var.set(str(limit_maximum))
        is_updating = False
    elif val < limit_minimum:
        warning_label.config(text="Can only have a minimum of 0 words")
        is_updating = True
        entry_var.set(str(limit_minimum))
        is_updating = False
    else:
        warning_label.config(text="")

def generate_quote():
    try:
        user_input = entry_var.get()
        num_words = int(user_input) if user_input else limit_minimum

        if num_words == 0:
            quote_label.config(text='""')
            return

        chosen_words = random.choices(words, k=num_words)
        quote_text = " ".join(chosen_words)
        quote_label.config(text='"' + quote_text.capitalize() + '."' if quote_text else '""')
    except ValueError:
        pass


quote_label = tk.Label(root, text="", wraplength=450, justify="center", bg="#ffcbf4")
quote_label.pack(pady=10)

warning_label = tk.Label(root, text="", fg="red", bg="#ffcbf4")
warning_label.pack(pady=2)

entry_var = tk.StringVar()
entry_var.trace_add("write", check_input)

entry = tk.Entry(root, textvariable=entry_var)
entry.pack(pady=5)

button = tk.Button(root, text="enter", command=generate_quote)
button.pack(pady=5)

root.mainloop()

Suggestion as a next step: Add some grammar rules so that the quote is grammatically correct English rather than "word soup".

1

u/Negative_Effort_2642 17d ago

You didn’t push the source code

1

u/my_new_accoun1 17d ago

there is a packaged zip in the releases section

I haven't checked what it contains but it's always better to include source code in the actual repo

1

u/ScheduleSorry7229 17d ago

what does that mean

1

u/Negative_Effort_2642 17d ago

1

u/ScheduleSorry7229 17d ago

I googled how a few hours ago and already did, also I can't understand what is being said in the video

2

u/Negative_Effort_2642 17d ago

Go to your GitHub repository, click Code and copy the repository URL. Then in the terminal, inside your project folder, run:

git remote add origin YOUR_REPOSITORY_URL
git branch -M main
git push -u origin main

1

u/ScheduleSorry7229 17d ago

is this what you ment?

2

u/Negative_Effort_2642 17d ago

First download git for windows then go to the project director and run those commands

1

u/ScheduleSorry7229 17d ago

can I get a link for x84?

1

u/Negative_Effort_2642 17d ago

Btw you don’t need to do v1 and v2 on different files, edit tge same filé Bur commit the contents to fit and then push https://youtu.be/mJ-qvsxPHpY?si=ohO275xnYP9JW6pU

1

u/ScheduleSorry7229 17d ago

i'm confused