Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import os
- window = Tk()
- window.title("Zero")
- c = Canvas(window, width = 240, height = 240, bg = 'black')
- c.pack()
- import datetime
- currentDateTime = datetime.datetime.now()
- minuteString = str(currentDateTime.minute)
- if(currentDateTime.minute < 10):
- minuteString = "0" + minuteString
- currentDate = str(currentDateTime.day) + " / " + str(currentDateTime.month) + " / " + str(currentDateTime.year)
- currentTime = str(currentDateTime.hour) + " : " + str(minuteString)
- dateText = c.create_text(120, 40, text=str(currentDate), fill='white', font=('Courier New', 16, "bold"))
- timeText = c.create_text(120, 80, text=str(currentTime), fill='white', font=('Courier New', 16, "bold"))
- import downloads
- itchIOViews = downloads.viewsItch()
- if downloads.checkInternet():
- downloadCount = int(downloads.downloadCountItch()) + downloads.downloadCountGoogle()
- if downloads.checkInternet() == False:
- downloadCount = "No Internet"
- viewText = c.create_text(120, 120, text="Views: " + itchIOViews, fill='white',
- font=('Courier New', 16, "bold"))
- downloadText = c.create_text(120, 160, text="Downloads: " + str(downloadCount), fill='white',
- font=('Courier New', 16, "bold"))
- import weather
- if downloads.checkInternet():
- weatherType = weather.weatherDescription()
- if downloads.checkInternet() == False:
- weatherType = "No Internet"
- weatherText = c.create_text(120, 200, text=str(weatherType), fill='white', font=('Courier New', 16, "bold"))
- import redtooth
- allDevices = redtooth.listDevices()
- if len(allDevices) < 1:
- deviceText = c.create_text(120, 120, text = "No Devices", fill='white', font=('Courier New', 16, "bold"))
- if len(allDevices) > 0:
- deviceText = c.create_text(120, 120, text = allDevices[0].btName, fill='white', font=('Courier New', 16, "bold"))
- currentBTNameIndex = 0
- allItems = [dateText, timeText, viewText, downloadText, weatherText, deviceText]
- screenNum = 0
- screenCount = 2
- def hideItems():
- for item in allItems:
- c.itemconfig(item, state="hidden")
- def showScreenOne():
- hideItems()
- screenOne = [dateText, timeText, viewText, downloadText, weatherText]
- for item in screenOne:
- c.itemconfig(item, state="normal")
- def showScreenTwo():
- hideItems()
- c.itemconfig(deviceText, state="normal")
- def changeScreens(event):
- global screenNum
- screenNum += 1
- if screenNum < 0:
- screenNum = 0
- if screenNum > screenCount - 1:
- screenNum = screenCount - 1
- screens = [showScreenOne, showScreenTwo]
- screens[screenNum]()
- def changeScreensTwo(event):
- global screenNum
- screenNum -= 1
- if screenNum < 0:
- screenNum = 0
- if screenNum > screenCount - 1:
- screenNum = screenCount - 1
- screens = [showScreenOne, showScreenTwo]
- screens[screenNum]()
- def downButton(event):
- if screenNum == 1:
- global currentBTNameIndex
- currentBTNameIndex += 1
- if currentBTNameIndex > len(allDevices) - 1:
- currentBTNameIndex = 0
- if len(allDevices) > 0:
- c.itemconfig(deviceText, text=allDevices[currentBTNameIndex].btName)
- if len(allDevices) < 1:
- c.itemconfig(deviceText, text="No Devices")
- def upButton(event):
- if screenNum == 1:
- if len(allDevices) > 0:
- #socket.close()
- redtooth.connect(allDevices[currentBTNameIndex].btId)
- changeScreensTwo(0)
- c.bind_all('<Right>', changeScreens)
- c.bind_all('<Left>', changeScreensTwo)
- c.bind_all('<Down>', downButton)
- c.bind_all('<Up>', upButton)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement