Example #1
0
class FullscreenWindow:
    def __init__(self):
        self.tk = Tk()
        self.tk.configure(background='black')
        self.topFrame = Frame(self.tk, background='black')
        self.bottomFrame = Frame(self.tk, background='black')
        self.topFrame.pack(side=TOP, fill=BOTH, expand=YES)
        self.bottomFrame.pack(side=BOTTOM, fill=BOTH, expand=YES)
        self.state = False
        self.tk.bind("<Return>", self.toggle_fullscreen)
        self.tk.bind("<Escape>", self.end_fullscreen)
        # weather
        self.weather = Weather(self.topFrame)
        self.weather.place(x=0, y=5, anchor=NW, width=700, height=400)
        # Date
        self.date = Date(self.topFrame)
        self.date.place(x=1015, y=10, anchor=NE, width=350, height=90)
        # Day
        self.day = Day(self.topFrame)
        self.day.place(x=860, y=10, anchor=NE, width=300, height=90)
        # clock
        self.clock = Clock(self.topFrame)
        self.clock.place(x=940, y=60, anchor=NE, width=250, height=90)
        #Seconds
        self.sec = Sec(self.topFrame)
        self.sec.place(x=1015, y=60, anchor=NE, width=80, height=85)
        # news
        self.news = News(self.bottomFrame)
        self.news.pack(side=LEFT, anchor=S, padx=0, pady=10)
        # Facial rec
        #self.FacialRecognition = News(self.bottomFrame)
        #self.FacialRecognition.pack(side=LEFT, anchor=N, padx=100, pady=60)
        # calender
        self.calender = Calendar(self.topFrame)
        self.calender.place(x=1015, y=150, width=250, anchor=NE)
        # calender Time
        self.calenderTime = CalendarTime(self.topFrame)
        self.calenderTime.place(x=850, y=172, width=250, anchor=NE)
        #Traffic
        self.traffic = Traffic(self.topFrame)
        #Launch
        self.launch = Launch(self.topFrame)
        #crypto name
        self.crypto = Crypto(self.topFrame)
        self.crypto.pack(side=TOP, anchor=NE)
        #Crypto Time
        self.cryptoPrice = CryptoPrice(self.topFrame)
        self.cryptoPrice.pack(side=TOP, anchor=NE)
        #camera
        s = FacialRec()

    def toggle_fullscreen(self, event=None):
        self.state = not self.state  # Just toggling the boolean
        self.tk.attributes("-fullscreen", self.state)
        return "break"

    def end_fullscreen(self, event=None):
        self.state = False
        self.tk.attributes("-fullscreen", False)
        return "break"