当前位置: 首页>>代码示例>>Python>>正文


Python Table.update方法代码示例

本文整理汇总了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
开发者ID:cigani,项目名称:pyTable2LaTeX,代码行数:104,代码来源:pytable.py

示例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)
开发者ID:loganrice,项目名称:unit_1_lesson_3,代码行数:6,代码来源:database.py


注:本文中的table.Table.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。