Bullet Journal Project

PHOTO EMBED

Sat Apr 29 2023 03:31:53 GMT+0000 (Coordinated Universal Time)

Saved by @CP #python

"""
SECTION 1:
In this first section you will find values and lists of values that are esential for the core functionality of the program.
"""
#This changes the size of the canvas
set_size(420,540) 

#This list contains the hexadeciaml number of the colors for each cover theme
#Color 1 is Blue
#Color 2 is Brown
#Color 3 is Pink 
COVER_COLORS = { 1: "#004aad" , 2: "#785326", 3: "#ff66c4"}

#Dictoniary with the links to the pictures of the covers that were made by the two participants of this project on Canva.
#Cover 1 stores the 'sports' 
#Cover 2 stores the 'minimalist'
#Cover 3 stores the 'disco'
COVERS = {1:"https://codehs.com/uploads/09e8c629d421cb66645de71dde8b4798", 2:  "https://codehs.com/uploads/af0e91788463ead695681f2283840ebe", 3:"https://codehs.com/uploads/54705063a2a26241f5acafb945d75164"}

#Dictionary with the links to the pictures of the emojis
#Credited at the end of the code.
#Emoji 1 is Sad
#Emoji 2 is Serious
#Emoji 3 is Happy
FEELINGS = ["https://codehs.com/uploads/704376e1c39be26d465a9d0404d542b3","https://codehs.com/uploads/54d2f29719875ed8fd92f9f9bba4b9bc", "https://codehs.com/uploads/cb753db8cc445e6c57797d883aaadcd0"]

#Dictionary with the links to the quote 
#Quote 1 is the sport theme quote
#Quote 2 is the minimalist theme quote
#Quote 3 is the disco theme quote
QUOTES = {1: "https://codehs.com/uploads/9ed1eb5685b925a27ad6913fe4b04e66", 2: "https://codehs.com/uploads/64454ad9f06c2424cc6223c1c5d4a3aa", 3: "https://codehs.com/uploads/48f6c924027970db60c9a044736ffb36"}

#This lists will be useful to simplify the code and make it more readable 
user_cover = ""

user_name = input("What's your name?")

"""
SECTION 2:
This part of the code will be useful to create the first page of the Bullet Journal, in other words, the cover of the notebook. 
During this section, the user will be selecting a number of theme that he or she wants. The theme and colors will be applied to the whole notebook. 
"""
#The following functions and loops will be useful to CREATE the personalized cover (theme and name) 

#Signature for the cover which is useful to identify whose Journal this is
#The signature will appear at the bottom of the cover
def cover_name(cover_selection):
    cover_signature = Text("By " + user_name)
    cover_signature.set_color(COVER_COLORS[cover_selection])
    cover_signature.set_font("15pt Comic Sans")
    cover_signature.set_position(210 - cover_signature.get_width()/2, 540 - cover_signature.get_height()*2 )
    add(cover_signature)

#Displays the information button on the cover
#The button doesn't work yet, this only adds the button to the cover.
def info_button_1():
    circle = Circle(15)
    circle.set_position(390, 30)
    circle.set_color(Color.blue)
    add(circle)
    i = Text("i")
    i.set_position(386, 40)
    i.set_color(Color.white)
    i.set_font("20pt Times New Roman")
    add(i)
    
#This functions makes the info_button works when the user clicks on it.
#The information is meant to show overall instructions so the user can start to use the journal.
def info_click(x,y):
    if (x > 375) and (x < 405):
        if (y > 15) and (y < 45):
            print ("""WELCOME TO YOUR OWN BULLET JOURNAL!! We hope you have a great time using this program
            
            CONTROL LIST:
                - Right Arrow: Move to next page
                - Left Arrow: Move to the previous page 
                - Left Click: Select and interact with your Bullet Journal
                """)
    elif (x > 370) and (x < 410):
        if (y > 505) and (y < 535):
            return
    
#Displays the button that will move the user to the next page
#This only adds the button to the cover, not the functionality
def next_page(): 
    circle_next = Circle(15)
    circle_next.set_position(395, 520)
    circle_next.set_color(COVER_COLORS[cover_selection])
    add(circle_next)
    line1 = Line(390, 520, 400, 520)
    line1.set_color(Color.white)
    add(line1)
    line2 = Line(395,515,400,520)
    line2.set_color(Color.white)
    add(line2)
    line3 = Line(395,525,400,520)
    line3.set_color(Color.white)
    add(line3)
    
#This makes the next_page button to work
#The button moves the user to page_1, where they will write about their day
def next_page_click(x,y):
    global current_page
    if (x > 370) and (x < 410):
        if (y > 505) and (y < 535):
            print_page()
    

#Prints the cover image of the user's preference (1,2, or 3) 
#The cover includes the user's name, the information button defined previously, and next page buttons.
def print_cover(cover_selection):
    cover = Image(COVERS[cover_selection])
    cover.set_size(420,540)
    cover.set_position(0,0)
    add(cover)
    cover_name(cover_selection)
    info_button_1()
    next_page()
    
#This loop avoids the user from entering a not valid value and having an error
while True:
    try:
        cover_selection = int(input("""Select the number of the theme for your cover 
        1: Sports 
        2: Minimalist 
        3: Disco"""))
        if (cover_selection > 0) and (cover_selection < 4):
            print_cover(cover_selection)
            user_cover = cover_selection
            break 
        else:
            continue 
    except ValueError:
        continue 
 
#The following functions and loops will be useful to CREATE the personalized page where the user will write about its day

#Displays the button that will move the user to the previous page, the cover
#This doens't work yet, it is just the button.
def previous_page():
    circle_previous = Circle(15)
    circle_previous.set_position(30, 520)
    circle_previous.set_color(COVER_COLORS[cover_selection])
    add(circle_previous)
    line1 = Line(25, 520, 35, 520)
    line1.set_color(Color.white)
    add(line1)
    line2 = Line(30,525,24,520)
    line2.set_color(Color.white)
    add(line2)
    line3 = Line(30,515,25,520)
    line3.set_color(Color.white)
    add(line3)
    
#Adds functionality to the previous_page button
#The button moves the user to the cover they personalized
def previous_page_click(x,y):
    if (x > 5) and (x < 45):
        if (y > 505) and (y < 535):
            print_cover(cover_selection)
    
#This adds the user's name to the bottom of the page
def page_signature():
    tag = Text(user_name + "'s Journal")
    tag.set_color("#ebd1a7")
    tag.set_font("15pt Comic Sans")
    tag.set_position(210 - tag.get_width()/2, 540 - tag.get_height()/2 )
    add(tag)

#Adds the title to the page of the journal
def title():
    title = Text("MY DAY")
    title.set_position(210 - title.get_width(), 56)
    title.set_color(COVER_COLORS[cover_selection])
    title.set_font("50pt Fantasy")
    add(title)
    

#These functions all come together to promt the use for their mood
#After, it will display an emoji according to their rating
def feeling():
    feeling_sqr = Rectangle(170,50)
    feeling_sqr.set_position(20, 92)
    feeling_sqr.set_color(COVER_COLORS[cover_selection]) 
    add(feeling_sqr)
    feeling_txt = Text("Mood")
    feeling_txt.set_position(60, 134)
    feeling_txt.set_color(Color.white)
    feeling_txt.set_font("30pt Fantasy")
    add(feeling_txt)

def feeling_click(x,y):
    if (x > 20) and (x < 180):
        if (y > 92) and (y < 142):
            feeling_question()

def feeling_question():
    while True:
        try:
            feeling_number = int(input("""On a scale of 1-5, how are you feeling? 
            5 = Best
            1 = Worst"""))
            
            if feeling_number < 3 and feeling_number > 0:
                sad=Image(FEELINGS[0])
                sad.set_size(170, 170)
                sad.set_position(20,150)
                add(sad)
                break
            
            elif feeling_number == 3:
                normal=Image(FEELINGS[1])
                normal.set_size(170, 170)
                normal.set_position(20,150)
                add(normal)
                break
            
            elif feeling_number > 3 and feeling_number < 6:
                happy=Image(FEELINGS[2])
                happy.set_size(170, 170)
                happy.set_position(20,150)
                add(happy)
            
                break
            
            else: 
                continue
        except ValueError:
            continue

#These functions all come together to promt the use for the number of glasses of water they had and display it
def water():
    water_sqr = Rectangle(170,50)
    water_sqr.set_position(210, 92)
    water_sqr.set_color(COVER_COLORS[cover_selection]) 
    add(water_sqr)
    water_txt = Text("Glasses of water")
    water_txt.set_position(215, 125)
    water_txt.set_color(Color.white)
    water_txt.set_font("18pt Fantasy")
    add(water_txt)

def water_click(x,y):
    if (x > 210) and (x < 380):
        if (y > 92) and (y < 142):
            water_question()

def water_question():
    while True:
        try:
            water_number = int(input("How many glasses of water did you drink?"))
            water_display_txt = Text(water_number)
            water_display_txt.set_position(280, 180)
            water_display_txt.set_color(Color.black)
            water_display_txt.set_font("40pt Impact")
            add(water_display_txt)
            break
        except ValueError:
            continue


#These functions all come together to promt the use for the number of meals they had and display it
def meals():
    meals_sqr = Rectangle(170,50)
    meals_sqr.set_position(210, 192)
    meals_sqr.set_color(COVER_COLORS[cover_selection]) 
    add(meals_sqr)
    meals_txt = Text("Meals")
    meals_txt.set_position(247, 231)
    meals_txt.set_color(Color.white)
    meals_txt.set_font("30pt Fantasy")
    add(meals_txt)

def meals_click(x,y):
    if (x > 210) and (x < 380):
        if (y > 192) and (y < 242):
            meals_question()
            
def meals_question():
    while True:
        try:
            meals_number = int(input("How many meals did you have?"))
            meals_display_txt = Text(meals_number)
            meals_display_txt.set_position(280, 280)
            meals_display_txt.set_color(Color.black)
            meals_display_txt.set_font("40pt Impact")
            add(meals_display_txt)
            break
        except ValueError:
            continue

#These functions all come together to promt the use for the number of hours of sleep they had and display it
def sleep():
    sleep_sqr = Rectangle(170,50)
    sleep_sqr.set_position(210, 292)
    sleep_sqr.set_color(COVER_COLORS[cover_selection]) 
    add(sleep_sqr)
    sleep_txt = Text("Hours of sleep")
    sleep_txt.set_position(218, 325)
    sleep_txt.set_color(Color.white)
    sleep_txt.set_font("20pt Fantasy")
    add(sleep_txt)

def sleep_click(x,y):
    if (x > 220) and (x < 380):
        if (y > 292) and (y < 342):
            sleep_question()

def sleep_question():
    while True:
        try:
            sleep_number = int(input("How many hours of sleep did you get?"))
            sleep_display_txt = Text(sleep_number)
            sleep_display_txt.set_position(280, 380)
            sleep_display_txt.set_color(Color.black)
            sleep_display_txt.set_font("40pt Impact")
            add(sleep_display_txt)
            break
        except ValueError:
            continue
    


#These functions all come together to promt the use for the number of glasses of water they had and display it
def assignment():
    assignment_sqr = Rectangle(170,50)
    assignment_sqr.set_position(210, 392)
    assignment_sqr.set_color(COVER_COLORS[cover_selection]) 
    add(assignment_sqr)
    assignment_txt = Text("Assignments done")
    assignment_txt.set_position(215, 425)
    assignment_txt.set_color(Color.white)
    assignment_txt.set_font("16pt Fantasy")
    add(assignment_txt)


def assignment_click(x,y):
    if (x > 210) and (x < 380):
        if (y > 392) and (y < 442):
            assignment_question()
            
def assignment_question():
    while True:
        try:
            assignment_number = int(input("How many assignments did you complete?"))
            assignment_display_txt = Text(assignment_number)
            assignment_display_txt.set_position(280, 480)
            assignment_display_txt.set_color(Color.black)
            assignment_display_txt.set_font("40pt Impact")
            add(assignment_display_txt)
            break 
        except ValueError:
            continue

#This function display a motivational quote for the user
def quote():
    quote = Image(QUOTES[cover_selection])
    quote.set_size(190,190)
    quote.set_position(10,322)
    add(quote)
    
#This function collects all titles on the second page that promt the user for data
def title_squares():
    feeling()
    add_mouse_click_handler(feeling_click)
    water()
    add_mouse_click_handler(water_click)
    meals()
    add_mouse_click_handler(meals_click)
    sleep()
    add_mouse_click_handler(sleep_click)
    assignment()
    add_mouse_click_handler(assignment_click)

#Displays the page which will have the information the user edits according to their day
def print_page():
    PAGE_BACKGROUND = Image("https://codehs.com/uploads/de707bc143c3e9f941fd380d4048cf36")
    PAGE_BACKGROUND.set_size(420, 540)
    PAGE_BACKGROUND.set_position(0,0)
    add(PAGE_BACKGROUND)
    page_signature()
    title()
    previous_page()
    title_squares()
    quote()
    
"""
Section 3:
Calling the mouse events for the info, previous and next page buttons. 
"""
add_mouse_click_handler(info_click)
add_mouse_click_handler(previous_page_click)
add_mouse_click_handler(next_page_click)



"""
CITATIONS:

Emojis:
Happy:
"Happy Free Icons Designed By Freepik". Flaticon, 2023, https://www.flaticon.com/free-icon/happy_1621782. Accessed 27 Apr 2023.
Serious:
"Meh Free Icons Designed By Freepik". Flaticon, 2023, https://www.flaticon.com/free-icon/meh_8538357. Accessed 27 Apr 2023."
Sad:
"Unhappy Free Icons Designed By Freepik". Flaticon, 2023, https://www.flaticon.com/free-icon/unhappy_8538354. Accessed 27 Apr 2023.
"""
content_copyCOPY