本文整理汇总了Python中table.Table.update方法的典型用法代码示例。如果您正苦于以下问题:Python Table.update方法的具体用法?Python Table.update怎么用?Python Table.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import update [as 别名]
#.........这里部分代码省略.........
menubar = Menu(master)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Open", command=self.openFile)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=master.destroy)
menubar.add_cascade(label="File", menu=filemenu)
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="About...", command=self.showAbout)
menubar.add_cascade(label="Help", menu=helpmenu)
master.config(menu=menubar)
def selectall(self, event):
event.widget.tag_add("sel","1.0","end")
def openFile(self):
self.text_raw.delete(1.0,END)
f = askopenfile(mode='r')
# clear the unwanted \r
f_text = f.read().replace('\r','')
self.text_raw.insert(END,f_text)
f.close()
def pasteFromClipboard(self):
""" paste from clipboard
"""
self.text_raw.delete(1.0,END)
self.text_raw.insert(END, self.master.clipboard_get())
def copyToClipboard(self):
""" copy to clipboard
"""
self.master.clipboard_clear()
self.master.clipboard_append(self.text_texed.get("1.0", 'end-1c'))
def showAbout(self):
""" show about info
"""
tkMessageBox.showinfo("About", "Made by Jingnan Shi - [email protected]")
def convert(self):
""" function called when convert is called
"""
print "converting ........."
# update the table
print "Source format: " + self.getSelectedFormat()
self.table.update(self.getRawString(), self.getSelectedFormat())
# get the latex table
print "Target style: " + self.getSelectedStyle()
latex_table = self.table.getLaTeX(self.getSelectedStyle(),self.math_var.get())
# update gui
self.updateTargetText(latex_table)
def getRawString(self):
""" get the raw table string in the app
"""
raw = self.text_raw.get("1.0", 'end-1c')
return raw
def updateTargetText(self, string):
""" update the text on the finished table text
"""
self.text_texed.config(state=NORMAL)
self.text_texed.delete(1.0, END)
self.text_texed.insert(END, string)
def getSelectedFormat(self):
""" return the GUI selected raw data format
"""
try:
# a bug in Tkinter 1.160 (Python 2.2) and earlier versions causes
# this list to be returned as a list of strings, instead of integers
selected_list = map(int, self.format_list.curselection())
format_index = selected_list[0]
raw_format = self.formats[format_index]
return raw_format
except IndexError:
print "Format not selected!"
return
def getSelectedStyle(self):
""" return the GUI selected latex style
"""
try:
# a bug in Tkinter 1.160 (Python 2.2) and earlier versions causes
# this list to be returned as a list of strings, instead of integers
selected_list = map(int, self.style_list.curselection())
style_index = selected_list[0]
style = self.styles[style_index]
return style
except IndexError:
print "Style not selected!"
return style
示例2: addColumn
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import update [as 别名]
def addColumn(self, table, column, dataType="text"):
params = {"tableName": table, "name": column, "dataType": dataType}
table = Table(params["tableName"], self.connection)
table.update(params)