Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import argparse
try:
import tkinter as tk
except:
import Tkinter as tk
pygubu_basedir = os.path.abspath(os.path.dirname(
os.path.dirname(os.path.realpath(sys.argv[0]))))
if pygubu_basedir not in sys.path:
sys.path.insert(0, pygubu_basedir)
from pygubu import Builder, TkApplication
class UITester(TkApplication):
def __init__(self, uifile, rootwidget, rootmenu=None, master=None):
self.uifile = uifile
self.rootwidget = rootwidget
self.rootmenu = rootmenu
TkApplication.__init__(self, master)
def _create_ui(self):
self.builder = Builder()
self.builder.add_from_file(self.uifile)
self.builder.get_object(self.rootwidget, self.master)
if self.rootmenu:
menu = self.builder.get_object(self.rootmenu, top)
self.set_menu(menu)
#show callbacks defined
def __init__(self, uifile, rootwidget, rootmenu=None, master=None):
self.uifile = uifile
self.rootwidget = rootwidget
self.rootmenu = rootmenu
TkApplication.__init__(self, master)
# menu.py
try:
import tkinter as tk
from tkinter import messagebox
except:
import Tkinter as tk
import tkMessageBox as messagebox
import pygubu
class MyApplication(pygubu.TkApplication):
def _create_ui(self):
#1: Create a builder
self.builder = builder = pygubu.Builder()
#2: Load an ui file
builder.add_from_file('menu.ui')
#3: Create the widget using self.master as parent
self.mainwindow = builder.get_object('mainwindow', self.master)
# Set main menu
self.mainmenu = menu = builder.get_object('mainmenu', self.master)
self.set_menu(menu)
# Configure callbacks
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
import tkinter as tk
import pygubu
from selenium import webdriver
from pyutil import Util
from pyutil import Mail
from pyutil import LibO
from pyutil import CFDIPDF
from values import Global
class Application(pygubu.TkApplication):
def __init__(self, parent):
self.parent = parent
self.util = Util()
self.g = Global()
self._init_var()
self._create_ui()
def _init_var(self):
self.builder = pygubu.Builder()
self.config = self.util.load_config(self.g.FILES['config'])
self.users_sat = {}
self.mail_servers = {}
self.users_xml = {}
self.users_pdf = {}
self.users_report = {}
txtcolor = 'black'
self.tklabel.configure(text=msg, foreground=txtcolor)
except (KeyboardInterrupt, SystemExit):
raise
except:
self.handleError(record)
def clear(self):
self.tklabel.configure(text='', foreground='black')
self._clear = True
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
class PygubuUI(pygubu.TkApplication):
"""Main gui class"""
def _init_before(self):
init_pygubu_widgets()
def _create_ui(self):
"""Creates all gui widgets"""
self.preview = None
self.about_dialog = None
self.preferences = None
self.builder = pygubu.Builder(translator)
self.currentfile = None
self.is_changed = False
uifile = os.path.join(FILE_PATH, "ui/pygubu-ui.ui")