python中intvar_Pythontkinter.IntVar⽅法代码⽰例
本⽂整理汇总了Python中tkinter.IntVar⽅法的典型⽤法代码⽰例。如果您正苦于以下问题:Python tkinter.IntVar⽅法的具体⽤
法?Python tkinter.IntVar怎么⽤?Python tkinter.IntVar使⽤的例⼦?那么恭喜您, 这⾥精选的⽅法代码⽰例或许可以为您提供帮助。您也可以进⼀步了解该⽅法所在模块tkinter的⽤法⽰例。
在下⽂中⼀共展⽰了tkinter.IntVar⽅法的16个代码⽰例,这些例⼦默认根据受欢迎程度排序。您可以为喜欢或者感觉有⽤的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码⽰例。
⽰例1: find
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def find(self, text_to_find):
length = tk.IntVar()
idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length)
if idx:
self.tag_remove('find_match', 1.0, tk.END)
end = f'{idx}+{()}c'
self.tag_add('find_match', idx, end)
self.see(idx)
self.find_search_starting_index = end
self.find_match_index = idx
else:
if self.find_match_index != 1.0:
if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"):
self.find_search_starting_index = 1.0
self.find_match_index = None
return self.find(text_to_find)
else:
msg.showinfo("No Matches", "No matching text found")
开发者ID:PacktPublishing,项⽬名称:Tkinter-GUI-Programming-by-Example,代码⾏数:23,
⽰例2: __init__
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs):
tk.Frame.__init__(self, parent, *args, **kwargs)
gridFrame = self._nametowidget(parent.winfo_parent())
self.parent = self._nametowidget(gridFrame.winfo_parent())
self.singleLabel = singleLabel = tk.Label(self, text=title)
self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0)
listbox.delete(0,tk.END)
listbox.insert(0,decimalPlaces)
checkboxValue = tk.IntVar()
checkboxValue.set(inThousands)
self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0) checkbox.var = checkboxValue
singleLabel.bind("", lambda e:self.dragStart(e, listbox, checkbox))
开发者ID:ArtificialQualia,项⽬名称:PyEveLiveDPS,代码⾏数:21,
⽰例3: create_infos
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def create_infos(self):
self.info_frame = tk.Frame()
self.id(row=0,column=1)
self.fps_label = tk.Label(self.info_frame,text="fps:")
self.fps_label.pack()
self.auto_range = tk.IntVar()
self.range_check = tk.Checkbutton(self.info_frame,
text="Auto range",variable=self.auto_range)
self.range_check.pack()
self.auto_apply = tk.IntVar()
self.auto_apply_check = tk.Checkbutton(self.info_frame,
text="Auto apply",variable=self.auto_apply)
variable used in lambdaself.auto_apply_check.pack()
self.minmax_label = tk.Label(self.info_frame,text="min: max:")
self.minmax_label.pack()
self.range_label = tk.Label(self.info_frame,text="range:")
self.range_label.pack()
self.bits_label = tk.Label(self.info_frame,text="detected bits:")
self.bits_label.pack()
<_label = tk.Label(self.info_frame,text="Zoom: 100%") _label.pack()
开发者ID:LaboratoireMecaniqueLille,项⽬名称:crappy,代码⾏数:25,⽰例4: load_settings
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def load_settings(self):
"""Load settings into our self.settings dict."""
vartypes = {
'bool': tk.BooleanVar,
'str': tk.StringVar,
'int': tk.IntVar,
'float': tk.DoubleVar
}
# create our dict of settings variables from the model's settings. self.settings = {}
for key, data in self.settings_model.variables.items():
vartype = (data['type'], tk.StringVar)
self.settings[key] = vartype(value=data['value'])
# put a trace on the variables so they get stored when changed.
for var in self.settings.values():
开发者ID:PacktPublishing,项⽬名称:Python-GUI-Programming-with-Tkinter,代码⾏数:21,⽰例5: _Button
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def _Button(self, text, image_file, toggle, frame):
if image_file is not None:
im = tk.PhotoImage(master=self, file=image_file)
else:
im = None
if not toggle:
b = tk.Button(master=frame, text=text, padx=2, pady=2, image=im,
command=lambda: self._button_click(text))
else:
# There is a bug in tkinter included in some python 3.6 versions
# that without this variable, produces a "visual" toggling of
# other near checkbuttons
var = tk.IntVar()
b = tk.Checkbutton(master=frame, text=text, padx=2, pady=2,
image=im, indicatoron=False,
command=lambda: self._button_click(text),
variable=var)
b._ntimage = im
b.pack(side=tk.LEFT)
return b
开发者ID:PacktPublishing,项⽬名称:Mastering-Elasticsearch-7.0,代码⾏数:25,
⽰例6: isearch
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def isearch(self, pattern, *args, **kwargs):
"""
Just search shortcut, in the sense it return the matched chunk
the initial position and the end position.
"""
count = IntVar()
index = self.search(pattern, *args, count=count, **kwargs)
if not index: return
len = ()
tmp = '%s +%sc' % (index, len)
chunk = (index, tmp)
pos0 = self.index(index)
pos1 = self.index('%s +%sc' % (index, len))
return chunk, pos0, pos1
开发者ID:vyapp,项⽬名称:vy,代码⾏数:18,
⽰例7: set
点赞 6
# 需要导⼊模块: import tkinter [as 别名]
# 或者: from tkinter import IntVar [as 别名]
def set(self, value):
"""
Set a new value.
Check whether value is in limits first. If not, return False and set
the new value to either be the minimum (if value is smaller than the minimum) or the maximum (if the value is larger than the maximum). Both str and int are supported as value types, as long as the str contains an int.
:param value: new value
:type value: int
"""
if not isinstance(value, int):
raise TypeError("value can only be of int type")
limited_value = max(min(self._high, value), self._low)
tk.IntVar.set(self, limited_value)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论