SHARE
TWEET

The Streak App

a guest Mar 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import tkinter as tk
  2. import datetime
  3. import calendar
  4. import pickle
  5. import os
  6. from tkinter import ttk
  7.  
  8.  
  9. XLARGE_FONT = ("Verdana", 36)
  10. LARGE_FONT = ("Verdana", 12)
  11.  
  12. class MainApplication(tk.Tk):
  13.     def __init__(self, *args, **kwargs):
  14.         tk.Tk.__init__(self, *args, **kwargs)
  15.         container = tk.Frame(self)
  16.  
  17.         container.pack(side="top", fill="both", expand = True)
  18.  
  19.         container.grid_rowconfigure(0, weight=1)
  20.         container.columnconfigure(0, weight=1)
  21.  
  22.         self.frames = {}
  23.  
  24.         for F in (StartPage, PageOne):
  25.  
  26.             frame = F(container, self)
  27.  
  28.             self.frames[F] = frame
  29.  
  30.             frame.grid(row=0, column=0, sticky="nsew")
  31.  
  32.         self.show_frame(StartPage)
  33.  
  34.     def show_frame(self, cont):
  35.         frame = self.frames[cont]
  36.         frame.tkraise()
  37.  
  38.     def add_time(self):
  39.         get_action = StringVar()
  40.         get_streak_num = Intvar()
  41.         get_day = IntVar()
  42.         get_hour = IntVar()
  43.         get_minute = IntVar()
  44.  
  45.         streak_input = {action: get_action , streak_num: get_streak_num,
  46.                         day: get_day, hour: get_hour, minute: get_minute}
  47.  
  48.         pickle.dump(streak_input, open("streak.obj", "wb"))
  49.  
  50.  
  51.  
  52. class StartPage(tk.Frame):
  53.     def __init__(self, parent, controller):
  54.         tk.Frame.__init__(self, parent)
  55.         start_title = tk.Label(self, text="Streak Starter", font=XLARGE_FONT)
  56.         start_title.pack(pady=10, padx=10)
  57.  
  58.         start_button = tk.Button(self, bg="medium purple", font=LARGE_FONT,
  59.                                 height=2, width=20, text="Start Streaking",
  60.                                 command=lambda: controller.show_frame(PageOne))
  61.         start_button.pack(anchor="center", pady=200)
  62.  
  63.  
  64. class PageOne(tk.Frame):
  65.     def __init__(self, parent, controller):
  66.         tk.Frame.__init__(self, parent)
  67.  
  68.         streak_title = tk.Label(self, text="New Streak", font=XLARGE_FONT)
  69.         streak_title.pack()
  70.  
  71.         action_label = tk.Label(self, text="Action", font=LARGE_FONT)
  72.         action_label.pack(anchor="w", padx=30, pady=10)
  73.  
  74.         action_text = tk.Entry(self, width=250)
  75.         action_text.pack(anchor="w", padx=30)
  76.  
  77.         streak_num_label = tk.Label(self, text="Streak #", font=LARGE_FONT)
  78.         streak_num_label.pack(anchor="w", padx=30, pady=10)
  79.  
  80.         streak_num_text = tk.Entry(self, width=250)
  81.         streak_num_text.pack(anchor="w", padx=30, pady=10)
  82.  
  83.         day_label = tk.Label(self, text="Day(s)")
  84.         day_label.pack()
  85.         due_day = tk.Entry(self, textvariable=day)
  86.         due_day.pack()
  87.  
  88.         hour_label = tk.Label(self, text="Hour(s)")
  89.         hour_label.pack()
  90.         due_hour = tk.Entry(self, textvariable=hour)
  91.         due_hour.pack()
  92.  
  93.         minute_label = tk.Label(self, text="Minute(s)")
  94.         minute_label.pack()
  95.         due_minute = tk.Entry(self, textvariable=minute)
  96.         due_minute.pack()
  97.  
  98.  
  99.  
  100. app = MainApplication()
  101. app.geometry("1280x960")
  102. app.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top