summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormcd223 <jacob@simplelittledream.com>2017-11-26 13:51:59 -0500
committerGitHub <noreply@github.com>2017-11-26 13:51:59 -0500
commit64aaf227d2049ae48743aba91cdb7a90d7bcad8d (patch)
treec86398b969cf473699982d1afb9ee80ec82172c0
parent8aea347ab0e17efe8eb993a26961639eb6f14524 (diff)
Add files via uploadmaster
-rw-r--r--c.py125
-rw-r--r--day.pngbin0 -> 37614 bytes
-rw-r--r--vvv.py158
3 files changed, 283 insertions, 0 deletions
diff --git a/c.py b/c.py
new file mode 100644
index 0000000..3eaffae
--- /dev/null
+++ b/c.py
@@ -0,0 +1,125 @@
+import tkinter
+from tkinter import *
+import datetime
+import time
+#main window everything goes in
+MainWindow = Tk()
+#Sections of the window
+topframe = Frame(MainWindow, bg="#323232")
+topframe.pack(side=TOP)
+bottomframe = Frame(MainWindow, bg="#323232")
+bottomframe.pack(side=BOTTOM)
+rightframe = Frame(MainWindow, bg="#323232")
+rightframe.pack(side=RIGHT)
+leftframe = Frame(MainWindow, bg="#323232")
+leftframe.pack(side=LEFT)
+today = datetime.date.today()
+ddday = datetime.date(1111, 11, 11)
+dday = today - ddday
+#functions
+def refresh_equation():
+ global dday
+ dday = today - ddday
+ print ("Displaying Days")
+ label.config(text = dday.days)
+def ww1s():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1914, 7, 28)#WW1 start date
+ refresh_equation()
+def ww1e():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1918, 11, 11)#WW1 end date
+ refresh_equation()
+def ww2s():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1939, 9, 1)#WW2 start date
+ refresh_equation()
+def ww2e():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1945, 9, 2)#WW2 end date
+ refresh_equation()
+def koreas():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1950, 6, 25)#Korean War start date
+ refresh_equation()
+def koreae():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1953, 7, 27)#Korean War end date
+ refresh_equation()
+def vietnams():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1955, 11, 1)#Vietnam War start date
+ refresh_equation()
+def vietname():
+ global ddday
+ print ("Calculating Days")
+ ddday = datetime.date(1975, 4, 30)#Vietnam War end date
+ refresh_equation()
+def reset():
+ print ("reset")
+ label.config(text ="")
+def dayinput():
+ print ("user input")
+ global today
+ e1 = int(entry1.get())
+ e2 = int(entry2.get())
+ e3 = int(entry3.get())
+ usi = datetime.date(e1, e2, e3)
+ useri = today - usi
+ useroutput.config(text=useri.days)
+def reset2():
+ print ("reset user input")
+ useroutput.config(text="")
+#items on screen
+TITLE = Label(leftframe, text="Important wars of the 20th Century", bg="#323232", fg="white", font="none 15")
+label = Label(leftframe, text="", font="none 20", bg="#323232", fg="white")
+ww1sb = Button(leftframe, text="WW1 Start", command=ww1s, bg="orange")
+ww1eb = Button(leftframe, text="WW1 End", command=ww1e, bg="green")
+ww2sb = Button(leftframe, text="WW2 Start", command=ww2s, bg="orange")
+ww2eb = Button(leftframe, text="WW2 End", command=ww2e, bg="green")
+koreasb = Button(leftframe, text="Korean War Start", command=koreas, bg="orange")
+koreaeb = Button(leftframe, text="Korean War End", command=koreae, bg="green")
+vietnamsb = Button(leftframe, text="Vietnam War Start", command=vietnams, bg="orange")
+vietnameb = Button(leftframe, text="Vietnam War End", command=vietname, bg="green")
+resetb = Button(leftframe, text="Reset", command=reset, bg="red")
+TITLE2 =Label(rightframe, text="Input your own date", bg="#323232", fg="white", font="none 15")
+entry1 = Entry(rightframe)
+entry2 = Entry(rightframe)
+entry3 = Entry(rightframe)
+syntax =Label(rightframe, text="YYYY, MM, DD", bg="#323232", fg="white", font="none 15")
+go = Button(rightframe, text="Go", bg="green", command=dayinput)
+reset2 = Button(rightframe, text="Reset", command=reset2, bg="red")
+useroutput = Label(rightframe, text="", bg="#323232", fg="white", font="none 15")
+#making those items
+TITLE.pack()
+label.pack()
+ww1sb.pack()
+ww1eb.pack()
+ww2sb.pack()
+ww2eb.pack()
+koreasb.pack()
+koreaeb.pack()
+vietnamsb.pack()
+vietnameb.pack()
+resetb.pack()
+TITLE2.pack()
+syntax.pack()
+entry1.pack()
+entry2.pack()
+entry3.pack()
+go.pack(side=LEFT)
+reset2.pack(side=LEFT)
+useroutput.pack()
+#window stuff
+MainWindow.title("Day Counter")
+MainWindow.geometry("700x331")
+MainWindow.configure(background="#323232")
+MainWindow.resizable(0,0)
+MainWindow.mainloop()
diff --git a/day.png b/day.png
new file mode 100644
index 0000000..bc1c1df
--- /dev/null
+++ b/day.png
Binary files differ
diff --git a/vvv.py b/vvv.py
new file mode 100644
index 0000000..3605700
--- /dev/null
+++ b/vvv.py
@@ -0,0 +1,158 @@
+import os
+import json
+import time
+import requests
+import praw
+from tkinter import *
+import tkinter as tk
+
+class pageindex(tk.Tk):
+
+ def __init__(self, *args, **kwargs):
+ tk.Tk.__init__(self, *args, **kwargs)
+
+
+
+ # the container is where we'll stack a bunch of frames
+ # on top of each other, then the one we want visible
+ # will be raised above the others
+ container = tk.Frame(self)
+ #container.pack(side="top", fill="both", expand=True)
+ container.grid(row=1, rowspan=2, column=1, columnspan=2)
+ container.grid_rowconfigure(0, weight=1)
+ container.grid_columnconfigure(0, weight=1)
+
+ self.frames = {}
+ for F in (ytscbyname, ytscbyid, PageTwo):
+ page_name = F.__name__
+ frame = F(parent=container, controller=self)
+ self.frames[page_name] = frame
+
+ # put all of the pages in the same location;
+ # the one on the top of the stacking order
+ # will be the one that is visible.
+ frame.grid(row=0, column=0, sticky="nsew")
+
+ self.show_frame("ytscbyname")
+
+ def show_frame(self, page_name):
+ '''Show a frame for the given page name'''
+ frame = self.frames[page_name]
+ frame.tkraise()
+
+class ytscbyname(tk.Frame):
+
+ def __init__(self, parent, controller):
+ tk.Frame.__init__(self, parent)
+ self.controller = controller
+ self.configure(background="#323232")
+ def Youtube_stats():
+ channel = ytuser.get()
+ r = requests.get('https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername='+channel+'&key=AIzaSyDdh94NZll6tzTUmO17d5nrh0zMuKcajaw')
+ j = r.json()
+ subs = j['items'][0]['statistics']['subscriberCount']
+ views = j['items'][0]['statistics']['viewCount']
+ ytsubs.config(text="{:,}".format(int(subs)))
+ ytviews.config(text="{:,}".format(int(views)))
+ def Ytreset():
+ ytsubs.config(text="")
+ ytviews.config(text="")
+
+
+ ytlabel = tk.Label(self, text="Youtube channel Stats by Name", bg="#323232", fg="white", font="none 15 bold")
+ ytuser = tk.Entry(self)
+ ytgo = tk.Button(self, text="GO", bg="green", command=Youtube_stats)
+ ytreset = tk.Button(self, text="Reset", bg="red", command=Ytreset)
+ ytsublabel = tk.Label(self, text="Total subs:", bg="#323232", fg="white", font="none 15")
+ ytviewslabel = tk.Label(self, text="Total Views:", bg="#323232", fg="white", font="none 15")
+ ytsubs = tk.Label(self, text="", bg="#323232", fg="white", font="none 15")
+ ytviews = tk.Label(self, text="", bg="#323232", fg="white", font="none 15")
+
+ menu = tk.Menu(self.master)
+ self.master.config(menu=menu)
+ YoutubeSubCounter = tk.Menu(menu)
+ YoutubeSubCounter.add_command(label="Youtube channel Stats by Name", command=lambda: controller.show_frame("ytscbyname"))
+ YoutubeSubCounter.add_command(label="Youtube channel Stats by ID", command=lambda: controller.show_frame("ytscbyid"))
+ menu.add_cascade(label="Youtube Channel Stats", menu=YoutubeSubCounter)
+
+ ytlabel.grid(row=1, column=1, columnspan=2)
+ ytuser.grid(row=2, column=1, columnspan=2)
+ ytgo.grid(row=3, column=1, sticky="E")
+ ytreset.grid(row=3, column=2, sticky="W")
+ ytsublabel.grid(row=4, column=1)
+ ytsubs.grid(row=4, column=2)
+ ytviewslabel.grid(row=5, column=1)
+ ytviews.grid(row=5, column=2)
+
+
+
+
+ button1 = tk.Button(self, text="Go to Page One",
+ command=lambda: controller.show_frame("ytscbyid"))
+ button2 = tk.Button(self, text="Go to Page Two",
+ command=lambda: controller.show_frame("PageTwo"))
+ button1.grid(row=6, column=1)
+ button2.grid(row=6, column=2)
+
+
+class ytscbyid(tk.Frame):
+
+ def __init__(self, parent, controller):
+ tk.Frame.__init__(self, parent)
+ self.controller = controller
+ self.configure(background="#323232")
+ def Youtube_stats():
+ ytid = ytuser.get()
+ r = requests.get('https://www.googleapis.com/youtube/v3/channels?part=statistics&id='+ytid+'&key=AIzaSyDdh94NZll6tzTUmO17d5nrh0zMuKcajaw')
+ j = r.json()
+ subs = j['items'][0]['statistics']['subscriberCount']
+ views = j['items'][0]['statistics']['viewCount']
+ ytsubs.config(text="{:,}".format(int(subs)))
+ ytviews.config(text="{:,}".format(int(views)))
+ def Ytreset():
+ ytsubs.config(text="")
+ ytviews.config(text="")
+
+
+ ytlabel = tk.Label(self, text="Youtube channel Stats by channel ID", bg="#323232", fg="white", font="none 15 bold")
+ ytuser = tk.Entry(self)
+ ytgo = tk.Button(self, text="GO", bg="green", command=Youtube_stats)
+ ytreset = tk.Button(self, text="Reset", bg="red", command=Ytreset)
+ ytsublabel = tk.Label(self, text="Total subs:", bg="#323232", fg="white", font="none 15")
+ ytviewslabel = tk.Label(self, text="Total Views:", bg="#323232", fg="white", font="none 15")
+ ytsubs = tk.Label(self, text="", bg="#323232", fg="white", font="none 15")
+ ytviews = tk.Label(self, text="", bg="#323232", fg="white", font="none 15")
+
+ ytlabel.grid(row=1, column=1, columnspan=2)
+ ytuser.grid(row=2, column=1, columnspan=2)
+ ytgo.grid(row=3, column=1, sticky="E")
+ ytreset.grid(row=3, column=2, sticky="W")
+ ytsublabel.grid(row=4, column=1)
+ ytsubs.grid(row=4, column=2)
+ ytviewslabel.grid(row=5, column=1)
+ ytviews.grid(row=5, column=2)
+
+
+
+
+ button1 = tk.Button(self, text="Go to Page One",
+ command=lambda: controller.show_frame("ytscbyname"))
+ button2 = tk.Button(self, text="Go to Page Two",
+ command=lambda: controller.show_frame("PageTwo"))
+ button1.grid(row=6, column=1)
+ button2.grid(row=6, column=2)
+class PageTwo(tk.Frame):
+
+ def __init__(self, parent, controller):
+ tk.Frame.__init__(self, parent)
+ self.controller = controller
+ label = tk.Label(self, text="This is page 2")
+ label.pack(side="top", fill="x", pady=10)
+ button = tk.Button(self, text="Go to the start page",
+ command=lambda: controller.show_frame("ytscbyid"))
+ button.pack()
+
+
+if __name__ == "__main__":
+ app = pageindex()
+ app.mainloop()