A new awesome Gemini client (I hope)
This commit is contained in:
commit
1abc943669
|
@ -0,0 +1,44 @@
|
|||
import tkinter as tk
|
||||
|
||||
# See https://tildegit.org/solderpunk/gemini-demo-1/src/branch/master/gemini-demo.py
|
||||
|
||||
class Application():
|
||||
def __init__(self):
|
||||
self.root = tk.Tk()
|
||||
self.nav_bar = NavBar(self)
|
||||
self.content = Content(self)
|
||||
self.root.mainloop()
|
||||
self.current_URL = "about:home"
|
||||
|
||||
def updateContent(self):
|
||||
text = self.nav_bar.getURL()
|
||||
self.content.setContent(text)
|
||||
self.current_URL = text
|
||||
|
||||
class NavBar():
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.URL_var = tk.StringVar()
|
||||
self.root = tk.Frame(self.parent.root)
|
||||
self.root.grid(column=0, row=0)
|
||||
self.URL_bar = tk.Entry(self.root, textvariable=self.URL_var)
|
||||
self.URL_var.set("about:home")
|
||||
self.URL_bar.grid(column=0, row=0)
|
||||
self.go_button = tk.Button(self.root, text='Go !', command=self.parent.updateContent)
|
||||
self.go_button.grid(column=1, row=0)
|
||||
|
||||
def getURL(self):
|
||||
return self.URL_var.get()
|
||||
|
||||
class Content():
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.root = tk.Frame(self.parent.root)
|
||||
self.root.grid(column=0, row=1)
|
||||
self.line = tk.Label(self.root, text="My home page")
|
||||
self.line.grid(column=0, row=0)
|
||||
|
||||
def setContent(self, new_content):
|
||||
self.line["text"] = new_content
|
||||
|
||||
app = Application()
|
Reference in New Issue