Pastebin

Paste #8101: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

import tkinter as tk

from flask import Flask
app = Flask(__name__)

root = tk.Tk()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()

root.attributes('-alpha', 0.0)  # For icon
root.iconify()

@app.route("/show")
def show():
    window = tk.Toplevel(root)
    window.geometry("%sx%s" % (screen_width, screen_height))
    window.configure(background='black', cursor='none')

    # No border
    window.overrideredirect(1)

    # Always on top
    window.attributes('-topmost', 1)

    #Whatever buttons, etc
    close = tk.Button(window, text = "Close Window", command = lambda: root.destroy())
    close.pack(fill = tk.BOTH, expand = 0)
    #close.pack(fill = tk.BOTH, expand = 1)

    window.mainloop()
    return "show!"


@app.route("/hide")
def hide():

    root = tk.Tk()
    screen_width = root.winfo_screenwidth()
    screen_height = root.winfo_screenheight()

    root.attributes('-alpha', 0.0) #For icon
    root.iconify()
    window = tk.Toplevel(root)
    window.geometry("%sx%s" % (screen_width, screen_height))
    window.configure(background='black', cursor='none')

    # No border
    window.overrideredirect(1)

    # Always on top
    window.attributes('-topmost', 1)

    #Whatever buttons, etc
    close = tk.Button(window, text = "Close Window", command = lambda: root.destroy())
    close.pack(fill = tk.BOTH, expand = 0)
    #close.pack(fill = tk.BOTH, expand = 1)

    window.mainloop()

    return "hide"

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.