added a lookup_frame, wrongly aligned, need to figure out how grid configuring works from the app=>frame=>widgets

This commit is contained in:
Joost Agterhoek 2024-08-17 12:01:05 +02:00
parent 1af1219b0d
commit 2c2c772811

View File

@ -7,8 +7,9 @@ from tkinter import ttk
from generic import sanitize, type_hosts_listed
ENTRY_LABEL = "Enter some IPs, domains, email addresses:"
APP_TITLE = "Extract and look up hosts"
ENTRY_LABEL = "Enter some IPs, domains, email addresses:"
IP_LABEL = "IP => hostname"
class InputFrame(ttk.Frame):
@ -37,6 +38,23 @@ class InputFrame(ttk.Frame):
typed = type_hosts_listed.type_hosts(sanitized)
class LookupFrame(ttk.Frame):
def __init__(self, container):
super().__init__(container)
self.columnconfigure(0, weight=2)
self.__create_widgets()
def __create_widgets(self) -> None:
ttk.Label(self, text=IP_LABEL).grid(column=0, row=3)
self.ip_listbox = tk.Listbox(self).grid(
column=0, row=3, columnspan=2, sticky="nsew"
)
for widget in self.winfo_children():
widget.grid(padx=0, pady=5)
class App(tk.Tk):
def __init__(self):
super().__init__()
@ -54,6 +72,8 @@ class App(tk.Tk):
# create the input frame
input_frame = InputFrame(self)
input_frame.grid(column=0, row=0)
lookup_frame = LookupFrame(self)
lookup_frame.grid(column=0, row=2)
if __name__ == "__main__":