日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python居中对齐代码end_Python tkinter.END属性代码示例

發布時間:2025/3/15 python 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python居中对齐代码end_Python tkinter.END属性代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文整理匯總了Python中tkinter.END屬性的典型用法代碼示例。如果您正苦于以下問題:Python tkinter.END屬性的具體用法?Python tkinter.END怎么用?Python tkinter.END使用的例子?那么恭喜您, 這里精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在模塊tkinter的用法示例。

在下文中一共展示了tkinter.END屬性的28個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點贊,您的評價將有助于我們的系統推薦出更棒的Python代碼示例。

示例1: find

?點贊 7

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [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}+{length.get()}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: receive_message

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def receive_message(self, message, smilies):

"""

Writes message into messages_area

:param message: message text

:param smilies: list of tuples of (char_index, smilie_file), where char_index is the x index of the smilie's location

and smilie_file is the file name only (no path)

:return: None

"""

self.messages_area.configure(state='normal')

self.messages_area.insert(tk.END, message)

if len(smilies):

last_line_no = self.messages_area.index(tk.END)

last_line_no = str(last_line_no).split('.')[0]

last_line_no = str(int(last_line_no) - 2)

for index, file in smilies:

smilie_path = os.path.join(SmilieSelect.smilies_dir, file)

image = tk.PhotoImage(file=smilie_path)

smilie_index = last_line_no + '.' + index

self.messages_area.image_create(smilie_index, image=image)

self.messages_area.configure(state='disabled')

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:25,

示例3: goto_path

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def goto_path(self, event):

frm = self.node_entry.get()

to = self.node_entry2.get()

self.node_entry.delete(0, tk.END)

self.node_entry2.delete(0, tk.END)

if frm == '':

tkm.showerror("No From Node", "Please enter a node in both "

"boxes to plot a path. Enter a node in only the first box "

"to bring up nodes immediately adjacent.")

return

if frm.isdigit() and int(frm) in self.canvas.dataG.nodes():

frm = int(frm)

if to.isdigit() and int(to) in self.canvas.dataG.nodes():

to = int(to)

self.canvas.plot_path(frm, to, levels=self.level)

開發者ID:jsexauer,項目名稱:networkx_viewer,代碼行數:20,

示例4: load

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def load(self, x, y):

name = ""

for key, val in self.master.data.data.items():

if val.get('position') == [x, y]:

name = key

break

if self.master.data.data[name] != {}:

self.form_entries['Description'].delete('1.0', tk.END)

self.form_entries["Description"].insert(tk.END, self.master.data.data[name]['description'])

self.variables["Icon"].set(self.master.data.data[name]['map_icon'])

self.variables["Location Name"].set(name)

self.variables["NPCs"].set(" ".join(self.master.data.data[name]['npc']))

for e, en in zip(self.exits_var, self.exits_names):

e.set(1 if en in self.master.data.data[name]['exits'] else 0)

else:

self.form_entries['Description'].delete('1.0', tk.END)

self.variables["Icon"].set("")

self.variables["Location Name"].set("")

self.variables["NPCs"].set("")

for e in self.exits_var:

e.set(0)

開發者ID:Dogeek,項目名稱:rpg-text,代碼行數:24,

示例5: spinbox_command

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def spinbox_command(action):

"""

n input spinbox up and down handler.

"""

value = int(math.sqrt(int(n_spinbox.get()) + 1))

# If up button clicked

if action == 'up':

value += 1

# If down button clicked

else:

if value == 3:

return

value -= 1

value = value * value - 1

n_spinbox.delete(0, tkinter.END)

n_spinbox.insert(0, value)

change_app_n(value)

# n spinbox

開發者ID:mahdavipanah,項目名稱:pynpuzzle,代碼行數:25,

示例6: __init__

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def __init__(self, root, resource_dir, lang="fr"):

ttk.Frame.__init__(self, root)

self.resource_dir = resource_dir

self._lang = None

langs = os.listdir(os.path.join(self.resource_dir, "master"))

if langs:

self._lang = (lang if lang in langs else langs[0])

self.items = (os.listdir(os.path.join(self.resource_dir, "master", self._lang)) if self._lang else [])

self.items.sort(key=lambda x: x.lower())

max_length = max([len(item) for item in self.items])

self.select_workflow_label = ttk.Label(root, text=u"select workflow:")

#strVar = tkinter.StringVar()

self.masters = tkinter.Listbox(root, width=max_length+1, height=len(self.items))#, textvariable=strVar)

for item in self.items:

self.masters.insert(tkinter.END, item)

開發者ID:YoannDupont,項目名稱:SEM,代碼行數:21,

示例7: on_moved

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def on_moved(self, event):

if not event.dest_path.endswith('.json'):

return

try:

currentProfileName = self.allSettings[self.selectedIndex.get()]["profile"]

except AttributeError:

return

settingsFile = open(self.fullPath, 'r')

self.allSettings = json.load(settingsFile)

settingsFile.close()

self.mainWindow.profileMenu.delete(0,tk.END)

self.initializeMenu(self.mainWindow)

i = 0

for profile in self.allSettings:

if (profile["profile"] == currentProfileName):

self.currentProfile = profile["profileSettings"]

self.selectedIndex.set(i)

self.mainWindow.event_generate('<>')

return

i += 1

self.currentProfile = self.allSettings[0]["profileSettings"]

self.selectedIndex.set(0)

self.mainWindow.event_generate('<>')

開發者ID:ArtificialQualia,項目名稱:PyEveLiveDPS,代碼行數:26,

示例8: addProfile

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def addProfile(self, add=False, duplicate=False, rename=False):

if (self.profileString.get() == "Default"):

tk.messagebox.showerror("Error", "There can only be one profile named 'Default'")

return

for profile in self.allSettings:

if self.profileString.get() == profile["profile"]:

tk.messagebox.showerror("Error", "There is already a profile named '" + self.profileString.get() + "'")

return

if add:

newProfile = copy.deepcopy(self.defaultProfile[0])

newProfile["profile"] = self.profileString.get()

self.allSettings.insert(0, newProfile)

elif duplicate:

newProfile = copy.deepcopy(self.allSettings[self.selectedIndex.get()])

newProfile["profile"] = self.profileString.get()

self.allSettings.insert(0, newProfile)

elif rename:

self.allSettings[self.selectedIndex.get()]["profile"] = self.profileString.get()

self.allSettings.insert(0, self.allSettings.pop(self.selectedIndex.get()))

self.mainWindow.profileMenu.delete(0,tk.END)

self.initializeMenu(self.mainWindow)

self.switchProfile()

self.newProfileWindow.destroy()

開發者ID:ArtificialQualia,項目名稱:PyEveLiveDPS,代碼行數:25,

示例9: __init__

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [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.grid(row="0", column="0", sticky="ew")

self.columnconfigure(0,weight=1)

self.singleLabel = singleLabel = tk.Label(self, text=title)

singleLabel.grid(row="0",column="0", sticky="ew")

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)

listbox.grid(row="0", column="1")

checkboxValue = tk.IntVar()

checkboxValue.set(inThousands)

self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0)

checkbox.var = checkboxValue

checkbox.grid(row="0", column="2")

singleLabel.bind("", lambda e:self.dragStart(e, listbox, checkbox))

開發者ID:ArtificialQualia,項目名稱:PyEveLiveDPS,代碼行數:21,

示例10: on_demo_select

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def on_demo_select(self, evt):

name = self.demos_lb.get( self.demos_lb.curselection()[0] )

fn = self.samples[name]

loc = {}

if PY3:

exec(open(fn).read(), loc)

else:

execfile(fn, loc)

descr = loc.get('__doc__', 'no-description')

self.linker.reset()

self.text.config(state='normal')

self.text.delete(1.0, tk.END)

self.format_text(descr)

self.text.config(state='disabled')

self.cmd_entry.delete(0, tk.END)

self.cmd_entry.insert(0, fn)

開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:20,

示例11: populate_text

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def populate_text(self):

self.text.insert(tk.END, "{}\n".format(APPNAME), ("title",

"center"))

self.text.insert(tk.END, "Copyright ? 2012-13 Qtrac Ltd. "

"All rights reserved.\n", ("center",))

self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n",

("center", "url", "above5"))

self.add_lines("""

This program or module is free software: you can redistribute it

and/or modify it under the terms of the GNU General Public License as

published by the Free Software Foundation, either version 3 of the

License, or (at your option) any later version. It is provided for

educational purposes and is distributed in the hope that it will be

useful, but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

General Public License for more details.""")

self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME,

VERSION), ("versions", "center", "above3"))

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:20,

示例12: load

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def load(self, filename):

self.delete("1.0", tk.END)

try:

with open(filename, "r", encoding="utf-8") as file:

self.insert("1.0", file.read())

except EnvironmentError as err:

self.set_status_text("Failed to load {}".format(filename))

return False

self.mark_set(tk.INSERT, "1.0")

self.edit_modified(False)

self.edit_reset()

self.master.title("{} \u2014 {}".format(os.path.basename(filename),

APPNAME))

self.filename = filename

self.set_status_text("Loaded {}".format(filename))

return True

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:18,

示例13: find

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def find(self, event=None):

text = self.findEntry.get()

assert text

length = len(text)

caseInsensitive = not self.caseSensitive.get()

wholeWords = self.wholeWords.get()

if wholeWords:

text = r"\m{}\M".format(re.escape(text)) # Tcl regex syntax

self.editor.tag_remove(FIND_TAG, "1.0", tk.END)

insert = self.editor.index(tk.INSERT)

start = self.editor.search(text, insert, nocase=caseInsensitive,

regexp=wholeWords)

if start and start == insert:

start = self.editor.search(text, "{} +{} char".format(

insert, length), nocase=caseInsensitive,

regexp=wholeWords)

if start:

self.editor.mark_set(tk.INSERT, start)

self.editor.see(start)

end = "{} +{} char".format(start, length)

self.editor.tag_add(FIND_TAG, start, end)

return start, end

return None, None

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:25,

示例14: populate_text

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def populate_text(self):

self.text.insert(tk.END, "{}\n".format(APPNAME), ("title",

"center"))

self.text.insert(tk.END, "Copyright ? 2012-13 Qtrac Ltd. "

"All rights reserved.\n", ("center",))

self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n", ("center",

"url", "above5"))

self.add_lines("""

This program or module is free software: you can redistribute it

and/or modify it under the terms of the GNU General Public License as

published by the Free Software Foundation, either version 3 of the

License, or (at your option) any later version. It is provided for

educational purposes and is distributed in the hope that it will be

useful, but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

General Public License for more details.""")

self.add_lines("""

{} was inspired by tile fall/same game which was originally

written for the Amiga and Psion by Adam Dawes.""".format(APPNAME))

self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME,

VERSION), ("versions", "center", "above3"))

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:23,

示例15: populate_text

?點贊 6

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def populate_text(self):

self.text.insert(tk.END, "{}\n".format(APPNAME), ("title",

"center"))

self.text.insert(tk.END, "Copyright ? 2012-13 Qtrac Ltd. "

"All rights reserved.\n", ("center",))

self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n", ("center",

"url", "above5"))

self.add_lines("""

This program or module is free software: you can redistribute it

and/or modify it under the terms of the GNU General Public License as

published by the Free Software Foundation, either version 3 of the

License, or (at your option) any later version. It is provided for

educational purposes and is distributed in the hope that it will be

useful, but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

General Public License for more details.""")

self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME,

VERSION), ("versions", "center", "above3"))

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:20,

示例16: select_all

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def select_all(self, event):

event.widget.tag_add(tk.SEL, "1.0", tk.END)

event.widget.mark_set(tk.INSERT, "1.0")

event.widget.see(tk.INSERT)

return "break"

開發者ID:nimaid,項目名稱:LPHK,代碼行數:7,

示例17: import_script

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def import_script(self, textbox, window):

name = tk.filedialog.askopenfilename(parent=window,

initialdir=files.SCRIPT_PATH,

title="Import script",

filetypes=load_script_filetypes)

if name:

text = files.import_script(name)

text = files.strip_lines(text)

textbox.delete("1.0", tk.END)

textbox.insert(tk.INSERT, text)

開發者ID:nimaid,項目名稱:LPHK,代碼行數:12,

示例18: export_script

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def export_script(self, textbox, window):

name = tk.filedialog.asksaveasfilename(parent=window,

initialdir=files.SCRIPT_PATH,

title="Export script",

filetypes=save_script_filetypes)

if name:

if files.SCRIPT_EXT not in name:

name += files.SCRIPT_EXT

text = textbox.get("1.0", tk.END)

text = files.strip_lines(text)

files.export_script(name, text)

開發者ID:nimaid,項目名稱:LPHK,代碼行數:13,

示例19: add_word

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def add_word(self):

"""

Adds the word/words to the words array, and refreshes the Listbox

:author: Pablo Sanz Alguacil

"""

new_words = self.entry_words.get().split(" ")

for word in new_words:

self.words.append(word)

self.listbox_words.delete(0, END)

self.listbox_words.insert(END, *self.words)

self.entry_words.delete(0, 'end')

開發者ID:pabloibiza,項目名稱:WiCC,代碼行數:15,

示例20: reset_list

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def reset_list(self):

"""

Deletes all elements in the words array and Listobx

:author: Pablo Sanz Alguacil

"""

self.words = []

self.listbox_words.delete(0, END)

開發者ID:pabloibiza,項目名稱:WiCC,代碼行數:11,

示例21: select_all

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def select_all(self, event=None):

self.tag_add("sel", 1.0, tk.END)

return "break"

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:6,

示例22: cancel_find

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def cancel_find(self):

self.find_search_starting_index = 1.0

self.find_match_index = None

self.tag_remove('find_match', 1.0, tk.END)

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:6,

示例23: tag_python

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def tag_python(event=None):

text.tag_configure('python', foreground="green")

start = 1.0

idx = text.search('python', start, stopindex=tk.END)

while idx:

tag_begin = idx

tag_end = f"{idx}+6c"

text.tag_add('python', tag_begin, tag_end)

start = tag_end

idx = text.search('python', start, stopindex=tk.END)

return "break"

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:15,

示例24: on_key_press

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def on_key_press(self, event=None):

final_index = str(self.text_widget.index(tk.END))

num_of_lines = final_index.split('.')[0]

line_numbers_string = "\n".join(str(no + 1) for no in range(int(num_of_lines)))

width = len(str(num_of_lines))

self.configure(state='normal', width=width)

self.delete(1.0, tk.END)

self.insert(1.0, line_numbers_string)

self.configure(state='disabled')

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:12,

示例25: highlight_regex

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def highlight_regex(self, regex, tag):

length = tk.IntVar()

start = 1.0

idx = self.text_widget.search(regex, start, stopindex=tk.END, regexp=1, count=length)

while idx:

end = f"{idx}+{length.get()}c"

self.text_widget.tag_add(tag, idx, end)

start = end

idx = self.text_widget.search(regex, start, stopindex=tk.END, regexp=1, count=length)

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:12,

示例26: send_message

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def send_message(self, event=None):

message = self.text_area.get(1.0, tk.END)

if message.strip() or len(self.text_area.smilies):

self.master.requester.send_message(

self.master.username,

self.friend_username,

message,

)

message = "Me: " + message

self.messages_area.configure(state='normal')

self.messages_area.insert(tk.END, message)

if len(self.text_area.smilies):

last_line_no = self.messages_area.index(tk.END)

last_line_no = str(last_line_no).split('.')[0]

last_line_no = str(int(last_line_no) - 2)

for index, file in self.text_area.smilies:

char_index = str(index).split('.')[1]

char_index = str(int(char_index) + 4)

smilile_index = last_line_no + '.' + char_index

self.messages_area.image_create(smilile_index, image=file)

self.text_area.smilies = []

self.messages_area.configure(state='disabled')

self.text_area.delete(1.0, tk.END)

return "break"

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:34,

示例27: add_smilie

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def add_smilie(self, smilie):

smilie_index = self.text_area.index(self.text_area.image_create(tk.END, image=smilie))

self.text_area.smilies.append((smilie_index, smilie))

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:5,

示例28: receive_message

?點贊 5

?

# 需要導入模塊: import tkinter [as 別名]

# 或者: from tkinter import END [as 別名]

def receive_message(self, author, message):

self.messages_area.configure(state='normal')

if author == self.master.username:

author = "Me"

message_with_author = author + ": " + message

self.messages_area.insert(tk.END, message_with_author)

self.messages_area.configure(state='disabled')

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:13,

注:本文中的tkinter.END屬性示例整理自Github/MSDocs等源碼及文檔管理平臺,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

總結

以上是生活随笔為你收集整理的python居中对齐代码end_Python tkinter.END属性代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。