Advertisement
JkSoftware

Python Critical Thinking Journal

Oct 9th, 2021
1,208
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import datetime
  3. from pathlib import Path
  4.  
  5.  
  6. parentfolder = os.path.join(r'C:\Users',os.getlogin(),'Documents','Journal')
  7. date = str(datetime.datetime.now())
  8.  
  9. def foldercheck():
  10.    try:
  11.         os.mkdir(parentfolder)
  12.    except OSError as error:
  13.         breakpoint
  14.          
  15. def menu():
  16.     print('Hello\nHow are you?')
  17.     print('1. People I admire\n2. Goals\n3. Habits\n4. Thought Redirection\n5. Journal')
  18.     usrchoice = str(input('What would you like to do?\n'))
  19.     while True:
  20.         if usrchoice == '1':
  21.             admire()
  22.         if usrchoice == '2':
  23.             goals()
  24.         if usrchoice == '3':
  25.             habits()
  26.         if usrchoice == '4':
  27.             thoughtredirection()
  28.         if usrchoice == '5':
  29.             journal()
  30.         else:
  31.             usrchoice = str(input('1, 2, 3, 4, 5\n'))
  32.                      
  33. def admiretextcheck():
  34.     admiretext = parentfolder + '\People I Admire.txt'
  35.     path = Path(admiretext)
  36.     if path.is_file():
  37.         breakpoint
  38.     else:
  39.         file = open(admiretext, 'w')
  40.  
  41. def journaltextcheck():
  42.     journaltext = parentfolder + '\Journal.txt'
  43.     path = Path(journaltext)
  44.     if path.is_file():
  45.         breakpoint
  46.     else:
  47.         file = open(journaltext, 'w')
  48.  
  49. def goalstextcheck():
  50.     goalstext = parentfolder + '\Goals.txt'
  51.     path = Path(goalstext)
  52.     if path.is_file():
  53.         breakpoint
  54.     else:
  55.         file = open(goalstext, 'w')
  56.  
  57. def habitstextcheck():
  58.     habitstext = parentfolder + '\Habits.txt'
  59.     path = Path(habitstext)
  60.     if path.is_file():      
  61.         breakpoint
  62.     else:
  63.         file = open(habitstext, 'w')
  64.  
  65. def thoughtredirecttextcheck():
  66.     thoughtredirecttext = parentfolder + '\Thought Redirection.txt'
  67.     path = Path(thoughtredirecttext)
  68.     if path.is_file():        
  69.         breakpoint
  70.     else:
  71.         file = open(thoughtredirecttext, 'w')
  72.  
  73. def dailyroutinetextcheck():
  74.     dailyroutinetext = parentfolder + '\Daily Routine.txt'
  75.     path = Path(dailyroutinetext)
  76.     if path.is_file():
  77.         breakpoint
  78.     else:
  79.         file = open(dailyroutinetext, 'w')
  80.  
  81. def admire():
  82.     admiretextcheck()
  83.     admiretext = parentfolder + '\People I Admire.txt'
  84.     clearConsole()
  85.     print('Hello! \nthis can be a list of anyone that has a trait(s) you admire')
  86.     print('You do not hav to admire everything about these people, and please be')
  87.     print('as specific as possible when describing what you admire about these people')
  88.     print('*Avoid should and would statements')
  89.     print('*Avoid Abbreviation' + '\n')
  90.     entryname = str(input('Name of this person: \n'))
  91.     entrytext = str(input('What do you admire about this person? \nRemember be specific as possible. \n'))
  92.     file = open(admiretext, 'a')
  93.     file.write(date + '\n')
  94.     file.write(entryname + '\n')
  95.     file.write(entrytext + '\n')
  96.     file.close()
  97.     y = str(input('Would you like to add another person?[y|n]' + '\n'))
  98.     while True:
  99.         if y == 'y':
  100.             admire()
  101.         if y == 'n':
  102.             print('Thanks! \nGoodbye :)')
  103.             Main()
  104.         else:
  105.             print('y or n\n')  
  106.             y = str(input('Would you like to add another person?[y|n]' + '\n'))
  107.  
  108. def journal():
  109.     journaltextcheck()
  110.     journaltext = parentfolder + '\Journal.txt'
  111.     clearConsole()
  112.     print('Hello! \nHow are you?')
  113.     entry = str(input('Tell me everything! :) \n'))
  114.     file = open(journaltext, 'a')
  115.     file.write(date + '\n')
  116.     file.write(entry + '\n')
  117.     file.close()
  118.     y = str(input('Would you like to write more?[y|n] \n'))
  119.     while True:
  120.         if y == 'y':
  121.             journal()
  122.         if y == 'n':
  123.             print('Thanks! \nGoodbye :)')
  124.             Main()
  125.         else:
  126.             print('y or n\n')  
  127.             y = str(input('Would you like to write more?[y|n]\n'))
  128.  
  129. def goals():
  130.     goalstextcheck()
  131.     goalstext = parentfolder + '\Goals.txt'
  132.     clearConsole()
  133.     print('We have "end" goals and sub goals, goals that serve our end goals.')
  134.     print('We need to take into consideration of our drive, desires, and values in order to set\nhealthy attainable goals')
  135.     print('It is good to have many sub goals in case one of our goals fails or becomes unattainable')
  136.     print('then we will have another goal to fall back on and still be working toward the same end goal\n')
  137.     entrytext = str(input('What is your goal?' + '\n'))
  138.     file = open(goalstext, 'a')
  139.     file.write(date + '\n')
  140.     file.write(entrytext + '\n')
  141.     file.close()
  142.     y = str(input('Would you like to add another goal?[y|n]\n'))
  143.     while True:
  144.         if y == 'y':
  145.             goals()
  146.         if y == 'n':
  147.             print('Thanks! \nGoodbye :)')
  148.             Main()
  149.         else:
  150.             print('y or n\n')  
  151.             y = str(input('Would you like to add another goal?[y|n]\n'))
  152.  
  153. def habits():
  154.     habitstextcheck()
  155.     habitstext = parentfolder + '\Habits.txt'
  156.     clearConsole()
  157.     print('Habits, both good and bad we all have them. The best way to know what habits are good or')
  158.     print('bad is to write them down. Be specific when describing your habits.')
  159.     print('*Avoid should and would statements')
  160.     print('*Avoid Abbreviation')
  161.     entrytype = str(input('Is this a good or bad habit? Just tell me if it is good or bad right now you can describe it next. \n'))
  162.     while True:
  163.         if entrytype == 'good':
  164.             break
  165.         if entrytype == 'Good':
  166.             break
  167.         if entrytype == 'bad':
  168.             break
  169.         if entrytype == 'Bad':
  170.             break
  171.         else:
  172.             print('Sorry, Just let me know if its a good or bad habit. You will be describing it next\n')  
  173.             entrytype = str(input('is this a good or bad habit? Just tell me if it is good or bad right now you can describe it next \n'))
  174.     entrydescr = str(input('Describe your habit \n'))
  175.     entrybenefit = str(input('Does this habit benifit you? [y|n]\n'))    
  176.     while True:
  177.         if entrybenefit == 'y':
  178.             break
  179.         if entrybenefit == 'n':
  180.             break
  181.         if entrybenefit == 'Y':
  182.             break
  183.         if entrybenefit == 'N':
  184.             break
  185.         else:
  186.             print('Sorry, Just tell me [y|n].\n')  
  187.             entrybenefit = str(input('Does this habit benifit you? [y|n]\n'))
  188.  
  189.     file = open(habitstext, 'a')
  190.     file.write(date + '\n')
  191.     file.write(entrytype + '\n')
  192.     file.write(entrydescr + '\n')
  193.     file.write(entrybenefit + '\n')
  194.     file.close()
  195.     y = str(input('Would you like to add another habit?[y|n]'))
  196.     while True:
  197.         if y == 'y':
  198.             habits()
  199.         if y == 'n':
  200.             print('Thanks! \nGoodbye :)')          
  201.             Main()
  202.         else:
  203.             print('y or n\n')  
  204.             y = str(input('Would you like to add another habit?[y|n]'))
  205.  
  206. def thoughtredirection():
  207.     thoughtredirecttextcheck()
  208.     thoughtrtext = parentfolder + '\Thought Redirection.txt'
  209.     clearConsole()
  210.     print('Thought Redirection is a great tool to use in hindsight.')
  211.     print('It helps you evaluate your negative thoughts and behaviors by looking at what happened')
  212.     print('Event/Thought ---> Behavior/Action ---> Redirection/Reason/What you should have done in')
  213.     print('place of your action')
  214.     print('This list should be updated often so you can evaluate yourself and make better decisions in the future')
  215.     entryevent = str(input('Describe the event/thought that caused the behavior/action \nBe specific \n*Avoid should and would statements \n*Avoid Abbreviation\n'))
  216.     entryaction = str(input('Describe the behavior/action\n'))
  217.     entryredirection = str(input('Describe what thought process could have been done in place of the negative behavior\n'))
  218.     file = open(thoughtrtext, 'a')
  219.     file.write(date + '\n')
  220.     file.write(entryevent + '\n' + entryaction + '\n' + entryredirection)
  221.     file.close()
  222.     y = str(input('Do you have another thought you would like to evaluate?[y|n]\n'))
  223.     while True:
  224.         if y == 'y':
  225.             thoughtredirection()
  226.         if y == 'n':
  227.             print('Thanks! \nGoodbye :)')
  228.             Main()
  229.         else:
  230.             print('y or n\n')  
  231.             y = str(input('Do you have another thought you would like to evaluate?[y|n]'))
  232.  
  233. def clearConsole():
  234.     command = 'clear'
  235.     if os.name in ('nt', 'dos'):
  236.         command = 'cls'
  237.     os.system(command)
  238.  
  239. def Main():
  240.     clearConsole()
  241.     foldercheck()
  242.     menu()
  243.  
  244.  
  245. Main()
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement