Files
lxc-manage/gui.py
2023-11-16 09:50:25 +01:00

70 lines
2.4 KiB
Python

import tkinter as tk
from tkinter import ttk
from subprocess import Popen, PIPE
from lxc_ls import LXCInfoGUI
from create import LxcLauncherGUI
class MyGUI:
def __init__(self, root):
self.root = root
self.root.title("Zwei Ansichten")
self.root.geometry("800x400") # Setze die Fenstergröße auf 800x400
menubar = tk.Menu(self.root)
self.root.config(menu=menubar)
menu1 = tk.Menu(menubar, tearoff=0)
menu1.add_command(label="lxc list", command=self.lxc_list)
menu1.add_command(label="lxc create", command=self.lxc_create)
menubar.add_cascade(label="LXC Manage", menu=menu1)
menu2 = tk.Menu(menubar, tearoff=0)
menu2.add_command(label="Menüpunkt 2.1", command=self.menu_item2_1)
menu2.add_command(label="Menüpunkt 2.2", command=self.menu_item2_2)
menubar.add_cascade(label="Menü 2", menu=menu2)
menu3 = tk.Menu(menubar, tearoff=0)
menu3.add_command(label="Menüpunkt 3.1", command=self.menu_item3_1)
menu3.add_command(label="Menüpunkt 3.2", command=self.menu_item3_2)
menubar.add_cascade(label="Menü 3", menu=menu3)
self.frame1 = ttk.Frame(self.root, style='Green.TFrame')
self.frame1.place(relx=0, rely=0, relwidth=1, relheight=0.4)
frame2 = ttk.Frame(self.root, style='Yellow.TFrame')
frame2.place(relx=0, rely=0.4, relwidth=1, relheight=0.6)
ttk.Separator(self.root, orient='horizontal').place(relx=0, rely=0.4, relwidth=1)
self.root.style = ttk.Style()
self.root.style.configure('Green.TFrame', background='#aaffaa')
self.root.style.configure('Yellow.TFrame', background='#ffffaa')
def lxc_list(self):
for widget in self.frame1.winfo_children():
widget.destroy()
lxc_info_app = LXCInfoGUI(self.frame1)
def lxc_create(self):
# Hier wird das LXC-Erstellungsfenster geöffnet
create_window = tk.Toplevel(self.root)
create_window.title("LXC Launcher")
create_app = LxcLauncherGUI(create_window)
def menu_item2_1(self):
print("Menüpunkt 2.1 wurde ausgewählt.")
def menu_item2_2(self):
print("Menüpunkt 2.2 wurde ausgewählt.")
def menu_item3_1(self):
print("Menüpunkt 3.1 wurde ausgewählt.")
def menu_item3_2(self):
print("Menüpunkt 3.2 wurde ausgewählt.")
if __name__ == "__main__":
root = tk.Tk()
app = MyGUI(root)
root.mainloop()