Created
March 25, 2019 06:18
-
-
Save sunsetsonwheels/73b09766e2d33a170f9f55b0098bddc6 to your computer and use it in GitHub Desktop.
PyWebviewEr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import Tk, messagebox, W, E, Menu | |
from tkinter.ttk import Button, Entry | |
from sys import exit | |
from threading import Thread | |
from webview import create_window | |
def start_thread(function): | |
t = Thread(target=function) | |
t.start() | |
def about_popup(): | |
messagebox.showinfo("About WebviewsEr", "WebviewEr allows you to browse the web.\n\nPlease do not use this as your main browser.\n\n(C) Nguyen Thanh Nam (jkelol111) 2019") | |
def newWebview(): | |
pass | |
root = Tk() | |
root.title("WebviewsEr") | |
root.wm_resizable(False, False) | |
root["bg"] = "white" | |
menubar = Menu(root) | |
filemenu = Menu(menubar, tearoff=0) | |
filemenu.add_command(label="Quit (CTRL+Q)", command=exit) | |
urlBar = Entry(root) | |
menubar.add_cascade(label="File", menu=filemenu) | |
aboutmenu = Menu(menubar, tearoff=0) | |
aboutmenu.add_command(label="About (CTRL+D)", command=about_popup) | |
urlBar.grid(row=0, column=0, sticky=W+E) | |
startDlButton = Button(root, text="Go!", command=lambda: start_thread(newWebview)) | |
startDlButton.grid(row=0, column=1) | |
root.config(menu=menubar) | |
root.update() | |
root.update_idletasks() | |
w = root.winfo_reqwidth() | |
h = root.winfo_reqheight() | |
x = (root.winfo_screenwidth() - w) / 2 | |
y = (root.winfo_screenheight() - h) / 2 | |
root.geometry("%dx%d+%d+%d" % (w, h, x, y)) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment