本文整理汇总了Python中ttk.Frame.focus_force方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.focus_force方法的具体用法?Python Frame.focus_force怎么用?Python Frame.focus_force使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Frame
的用法示例。
在下文中一共展示了Frame.focus_force方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Metadator
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import focus_force [as 别名]
class Metadator(Tk):
def __init__(self):
u"""
Main window constructor
Creates 1 frame and 2 labeled subframes
"""
# first: the log
# see: http://sametmax.com/ecrire-des-logs-en-python/
self.logger = logging.getLogger()
self.logger.setLevel(logging.DEBUG) # all errors will be get
log_form = logging.Formatter('%(asctime)s || %(levelname)s || %(message)s')
logfile = RotatingFileHandler('Metadator_LOG.log', 'a', 5000000, 1)
logfile.setLevel(logging.DEBUG)
logfile.setFormatter(log_form)
self.logger.addHandler(logfile)
self.logger.info('\n\t ======== Metadator ========') # first messages
self.logger.info('Starting the UI')
# checking the path to GDAL in the path
if "GDAL_DATA" not in env.keys():
try:
gdal.SetConfigOption(str('GDAL_DATA'),
str(path.abspath(r'data/gdal')))
except:
print("Oups! Something has gone wrong...\
see: https://github.com/Guts/Metadator/issues/21")
else:
pass
# basics settings
Tk.__init__(self) # constructor of parent graphic class
self.title(u'Metadator {0}'.format(MetadatorVersion))
self.style = Style() # more friendly windows style
if opersys == 'win32':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.iconbitmap('Metadator.ico') # windows icon
self.uzer = env.get(u'USERNAME')
elif opersys == 'linux2':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.uzer = env.get(u'USER')
icon = Image("photo", file=r'data/img/metadator.gif')
self.call('wm', 'iconphoto', self._w, icon)
self.minsize(580, 100)
self.style.theme_use('clam')
elif opersys == 'darwin':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.uzer = env.get(u'USER')
else:
self.logger.warning('Operating system not tested')
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.resizable(width=False, height=False)
self.focus_force()
self.logger.info('GDAL version: {}'.format(gdal.__version__))
# variables
self.def_rep = "" # folder to search for
self.def_lang = 'FR' # language to start
self.def_doc = IntVar() # to export into Word
self.def_xls = IntVar() # to export into Excel 2003
self.def_xml = IntVar() # to export into ISO 19139
self.def_cat = IntVar() # to merge all output Word files
self.def_odt = IntVar() # to export into OpenDocumentText
self.def_dict = IntVar() # to make a dictionnary of data
self.def_kass = IntVar() # to handle field name case sensitive
self.def_stat = IntVar() # to active/disable stats fields
self.li_pro = [] # list for profiles in language selected
self.li_shp = [] # list for shapefiles path
self.li_tab = [] # list for MapInfo tables path
self.num_folders = 0 # number of folders explored
self.today = strftime("%Y-%m-%d") # date of the day
self.dico_layer = OD() # dictionary about layer properties
self.dico_profil = OD() # dictionary from profile selected
self.dico_fields = OD() # dictionary for fields information
self.dico_rekur = OD() # dictionary of recurring attributes
self.dico_err = OD() # errors list
self.dico_help = OD() # dictionary of help texts
li_lang = [lg for lg in listdir(r'locale')] # available languages
self.blabla = OD() # texts dictionary
# GUI fonts
ft_tit = tkFont.Font(family="Times", size=10, weight=tkFont.BOLD)
# fillfulling
self.load_settings()
self.load_texts(self.def_lang)
self.li_profiles(self.def_lang)
self.li_rekurs(self.def_lang)
self.recup_help(self.def_lang)
# Tabs
self.nb = Notebook(self)
self.tab_globals = Frame(self.nb) # tab_id = 0
self.tab_options = Frame(self.nb) # tab_id = 1
self.tab_attribs = Frame(self.nb) # tab_id = 2
self.nb.add(self.tab_globals,
text=self.blabla.get('gui_tab1'), padding=3)
self.nb.add(self.tab_options,
text=self.blabla.get('gui_tab2'), padding=3)
self.nb.add(self.tab_attribs,
#.........这里部分代码省略.........