add Frame widget 3
for Buttons and Listbox with Scrollbar. all Widgets new format delete works now of disable checkbox when Listbox empty (part two)
This commit is contained in:
36
wg_func.py
36
wg_func.py
@ -2,7 +2,7 @@
|
||||
import os
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
from tkinter import filedialog
|
||||
from tkinter import filedialog, ttk
|
||||
import tkinter as tk
|
||||
|
||||
font_color = '#4011a7'
|
||||
@ -41,30 +41,31 @@ class GreenLabel(tk.Tk):
|
||||
def green_show_label(self):
|
||||
self.lb_tunnel = tk.Label(self, textvariable=self.StrVar, fg='green')
|
||||
self.lb_tunnel.config(font=('Ubuntu', 11, 'bold'))
|
||||
self.lb_tunnel.grid(column=2, padx=10, row=1)
|
||||
self.lb_tunnel.grid(column=2, padx=10, row=0)
|
||||
self.columnconfigure(2, weight=1)
|
||||
self.rowconfigure(1, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
|
||||
|
||||
class StartStopBTN(tk.Tk):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.lb_frame_buttons = None
|
||||
self.wg_switch = None
|
||||
self.btn_stst = None
|
||||
self.wg_vpn_start = tk.PhotoImage(file=r'icons/wg-vpn-start-48.png')
|
||||
self.wg_vpn_stop = tk.PhotoImage(file=r'icons/wg-vpn-stop-48.png')
|
||||
|
||||
def button_stop(self):
|
||||
self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
|
||||
self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s")
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(1, weight=1)
|
||||
self.btn_stst = tk.Button(self.lb_frame_buttons, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
|
||||
self.btn_stst.grid(column=0, row=0, padx=15, pady=8)
|
||||
#self.columnconfigure(0, weight=1)
|
||||
#self.rowconfigure(0, weight=1)
|
||||
|
||||
def button_start(self):
|
||||
self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
|
||||
self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s")
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(1, weight=1)
|
||||
self.btn_stst = tk.Button(self.lb_frame_buttons, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
|
||||
self.btn_stst.grid(column=0, row=0, padx=15, pady=8)
|
||||
#self.columnconfigure(0, weight=1)
|
||||
#self.rowconfigure(0, weight=1)
|
||||
|
||||
|
||||
class ConToDict:
|
||||
@ -143,15 +144,15 @@ class ShowAddress(tk.Tk):
|
||||
def show_data(self):
|
||||
# Address Label
|
||||
self.address = tk.Label(self.lb_frame, textvariable=self.add, fg='blue')
|
||||
self.address.grid(column=0, row=5, sticky='w', padx=10)
|
||||
self.address.grid(column=0, row=4, sticky='w', padx=10, pady=6)
|
||||
self.address.config(font=('Ubuntu', 9))
|
||||
# DNS Label
|
||||
self.dns = tk.Label(self.lb_frame, textvariable=self.DNS, fg='blue')
|
||||
self.dns.grid(column=0, row=6, sticky='w', padx=10, pady=3)
|
||||
self.dns.grid(column=0, row=6, sticky='w', padx=10, pady=6)
|
||||
self.dns.config(font=('Ubuntu', 9))
|
||||
# Endpoint Label
|
||||
self.endpoint = tk.Label(self.lb_frame2, textvariable=self.enp, fg='blue')
|
||||
self.endpoint.grid(column=0, row=8, sticky='w', padx=10, pady=5)
|
||||
self.endpoint.grid(column=0, row=7, sticky='w', padx=10, pady=10)
|
||||
self.endpoint.config(font=('Ubuntu', 9))
|
||||
|
||||
|
||||
@ -268,6 +269,7 @@ class FileHandle:
|
||||
set_off = open('wg_py.xml', 'w')
|
||||
set_off.write(word_replace)
|
||||
set_off.close()
|
||||
|
||||
except IndexError:
|
||||
self.selected_option.set(1)
|
||||
|
||||
@ -277,6 +279,7 @@ class FileHandle:
|
||||
class OnOff(tk.Tk, FileHandle):
|
||||
def __init__(self, container, **kwargs):
|
||||
super().__init__(container, **kwargs)
|
||||
self.lb_frame_buttons = None
|
||||
|
||||
def on_off(self):
|
||||
a_connect = {}
|
||||
@ -286,6 +289,7 @@ class OnOff(tk.Tk, FileHandle):
|
||||
a_connect[line_splitted[0]] = line_splitted[1]
|
||||
if 'true' in a_connect:
|
||||
self.selected_option.set(1)
|
||||
self.autoconnect_var.set('')
|
||||
self.auto_con = a_connect['true']
|
||||
|
||||
else:
|
||||
@ -295,9 +299,9 @@ class OnOff(tk.Tk, FileHandle):
|
||||
|
||||
self.autoconnect_var = tk.StringVar()
|
||||
self.autoconnect_var.set(self.auto_con)
|
||||
self.autoconnect = tk.Label(self, textvariable=self.autoconnect_var, bd=2, fg='blue', padx=5)
|
||||
self.autoconnect = tk.Label(self, textvariable=self.autoconnect_var, fg='blue', padx=5)
|
||||
self.autoconnect.config(font=('Ubuntu', 11))
|
||||
self.autoconnect.grid(column=1, row=4, sticky='we')
|
||||
self.autoconnect.grid(column=0, row=4, sticky='ne', pady=20)
|
||||
|
||||
|
||||
class ExportTunnels:
|
||||
|
Reference in New Issue
Block a user