Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- import datetime
- import calendar
- import pickle
- import os
- from tkinter import ttk
- XLARGE_FONT = ("Verdana", 36)
- LARGE_FONT = ("Verdana", 12)
- class MainApplication(tk.Tk):
- def __init__(self, *args, **kwargs):
- tk.Tk.__init__(self, *args, **kwargs)
- container = tk.Frame(self)
- container.pack(side="top", fill="both", expand = True)
- container.grid_rowconfigure(0, weight=1)
- container.columnconfigure(0, weight=1)
- self.frames = {}
- for F in (StartPage, PageOne):
- frame = F(container, self)
- self.frames[F] = frame
- frame.grid(row=0, column=0, sticky="nsew")
- self.show_frame(StartPage)
- def show_frame(self, cont):
- frame = self.frames[cont]
- frame.tkraise()
- def add_time(self):
- get_action = StringVar()
- get_streak_num = Intvar()
- get_day = IntVar()
- get_hour = IntVar()
- get_minute = IntVar()
- streak_input = {action: get_action , streak_num: get_streak_num,
- day: get_day, hour: get_hour, minute: get_minute}
- pickle.dump(streak_input, open("streak.obj", "wb"))
- class StartPage(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- start_title = tk.Label(self, text="Streak Starter", font=XLARGE_FONT)
- start_title.pack(pady=10, padx=10)
- start_button = tk.Button(self, bg="medium purple", font=LARGE_FONT,
- height=2, width=20, text="Start Streaking",
- command=lambda: controller.show_frame(PageOne))
- start_button.pack(anchor="center", pady=200)
- class PageOne(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- streak_title = tk.Label(self, text="New Streak", font=XLARGE_FONT)
- streak_title.pack()
- action_label = tk.Label(self, text="Action", font=LARGE_FONT)
- action_label.pack(anchor="w", padx=30, pady=10)
- action_text = tk.Entry(self, width=250)
- action_text.pack(anchor="w", padx=30)
- streak_num_label = tk.Label(self, text="Streak #", font=LARGE_FONT)
- streak_num_label.pack(anchor="w", padx=30, pady=10)
- streak_num_text = tk.Entry(self, width=250)
- streak_num_text.pack(anchor="w", padx=30, pady=10)
- day_label = tk.Label(self, text="Day(s)")
- day_label.pack()
- due_day = tk.Entry(self, textvariable=day)
- due_day.pack()
- hour_label = tk.Label(self, text="Hour(s)")
- hour_label.pack()
- due_hour = tk.Entry(self, textvariable=hour)
- due_hour.pack()
- minute_label = tk.Label(self, text="Minute(s)")
- minute_label.pack()
- due_minute = tk.Entry(self, textvariable=minute)
- due_minute.pack()
- app = MainApplication()
- app.geometry("1280x960")
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement