コード例 #1
0
 def update_table(self):
     try:
         temp_dict = {}
         for meas in self.meas_array:
             with self.session.initiate():
                 measurement_stat = self.session.channels[
                     self.config_channels].fetch_measurement_stats(
                         niscope.enums.ScalarMeasurement[meas], 5.0)
                 for stat in measurement_stat:
                     inner_temp_dict = {}
                     inner_temp_dict["Measurement"] = meas
                     inner_temp_dict["Channel"] = stat.channel
                     inner_temp_dict["Result"] = stat.result
                     inner_temp_dict["Mean"] = stat.mean
                     inner_temp_dict["StDev"] = stat.stdev
                     inner_temp_dict["Min"] = stat.min_val
                     inner_temp_dict["Max"] = stat.max_val
                     inner_temp_dict["Num in Stats"] = stat.num_in_stats
                     key = meas + "_" + stat.channel
                     temp_dict[key] = inner_temp_dict
         self.table = TableCanvas(self.table_frame,
                                  data=temp_dict,
                                  read_only=True)
         self.table.show()
     except Exception as e:
         self._set_message(str(e))
コード例 #2
0
 def __init__(self,root):
     self.f=Frame(root,height=200,width=100)
     self.f.pack(fill=BOTH,expand=1)
     self.table=TableCanvas(self.f,read_only=True)
     self.table.importCSV('/media/amit/Work/GitHub/Machine Learning with Python/DataSets/empsal.csv')
     print(self.table.model.columnNames)
     self.table.show()
コード例 #3
0
  def classify_handler(self):

    # Show Classification waiting window
    wdw = Tkinter.Toplevel()
    wdw.title('Classification Results ' + self.dropdown_value.get())
    Tkinter.Label(wdw, text="Classification in Progress... Please wait", font=("Helvetica", 12), width=50, fg="blue").pack()
    wdw.update()
    wdw.deiconify()
  
    # Predict and load results
    resultModel = TableModel()
    resultDict = speakerclassifier.classify_audio(self.currentFile, self.dropdown_value.get())
    if len(resultDict) > 0 :
      resultModel.importDict(resultDict)
    wdw.destroy()
  
    if len(resultDict) > 0 :
      # Show Classification results in modal table window
      wdw = Tkinter.Toplevel()
      wdw.geometry('350x200+200+200')
      wdw.title('Classification Results ' + self.dropdown_value.get())
      tframe = Tkinter.Frame(wdw)
      tframe.pack()
      
      table = TableCanvas(tframe, model=resultModel, editable=False)
      table.createTableFrame()
      table.sortTable(columnName='Score (%)', reverse=True)
      
      wdw.transient(self.root)
      wdw.grab_set()
      self.root.wait_window(wdw)
    else :
      tkMessageBox.showerror('Classification Results', 'There are currently no users in the System')
コード例 #4
0
def DataGrid(xValues, yValues):
    ## setup window
    dataGrid = Tk()
    dataGrid.wm_title("Data")

    ## setup frame
    frame = Frame(dataGrid)
    frame.pack()

    label = Label(dataGrid, text=("Showing %.0f data points" % len(xValues)), font=("Verdana", 12))
    label.pack(pady=5, padx=10)

    dataDict = {}

    ## iterate through time
    for i in range(0, len(xValues)):
        xVal = "%.2f" % float(xValues[i])
        yVal = "%.2f" % float(yValues[i])
        dataDict[xVal] = {"Time (s)": xVal, "Height (m)": yVal}

    model = TableModel()
    model.importDict(dataDict)
    model.moveColumn(model.getColumnIndex("Time (s)"), 0)

    table = TableCanvas(frame, model=model, editable=False)
    table.createTableFrame()

    ## order by time
    table.sortTable(columnName="Time (s)")

    dataGrid.mainloop()
class create_csv:
    
    def __init__(self,root):
        self.f= Frame(root, height=350, width=500)
        self.f.pack() # Place the frame on root window
        
        #Creating label widgets
        self.message_label = Label(self.f,text='Conversion of stock Price Excel file to CSV ' , font=('Arial', 14))
        
        #Buttons
        self.confirm_button= Button(self.f,text='Load & Display', font=('Arial',14),bg='Orange', fg='Black', command=self.display_excel)
        self.exit_button=Button(self.f,text='Exit', font=('Arial',14),bg='Yellow', fg='Black',command=root.destroy)
        
        #Placing the widgets using grid manager
        
        self.message_label.grid(row=1,column=0)
        self.confirm_button.grid(row=2,column=0)
        self.exit_button.grid(row=2,column=2)
        
    def display_excel(self):
        try:
            stock_price_df=pd.read_excel('E:\project5\stock_price.xls', sheet_name='Stock')
            stock_price_df.to_csv('E:\project5\stock_price.csv', index=False)
            
            # Now display the csv in 'tkintertable' widget
            self.f= Frame(root,height=200 , width=300)
            self.f.pack(fill=BOTH, expand=1)
            self.table= TableCanvas(self.f , read_only=True)
            self.table.importCSV('E:\project5\stock_price.csv')
            #print(self.table.mode1.columnNames)# to print column names in IDLE shell
        except FileNotFoundError as e:
            print(e)
コード例 #6
0
    def display_leaderboard(self):
        self.cursor.execute(
            'SELECT player.username, MAX(data.kills) AS kills, data.date FROM data INNER JOIN player ON data.playerID = player.playerID GROUP BY username limit 0, 10 '
        )
        result = self.cursor.fetchall()
        data = Convert(result)

        kills_dict = dict()
        for key in data:
            data_value = list(data[key].values())
            kills_dict[key] = data_value[1]

        kills_dict = mergeSortDict(kills_dict, ascending=False)

        final_dict = dict()

        for key in kills_dict:
            final_dict[key] = data[key]

        tframe = Frame(self.my_w)
        tframe.pack()
        model = TableModel()
        table = TableCanvas(tframe,
                            model=model,
                            data=final_dict,
                            editable=False,
                            width=800,
                            height=300)
        table.show()
        self.my_w.mainloop()
コード例 #7
0
ファイル: view.py プロジェクト: malgo0102/GUI-logs
    def __init__(self, root, model, controller):
        self.model = model
        self.root = root
        self.controller = controller
        self.popup = Popup(model)

        # Table setup
        self.frame_table = tk.Frame(root)
        self.table = TableCanvas(self.frame_table)
        self.table.show()

        self.frame_table.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

        # Buttons setup
        self.frame_buttons = tk.Frame(root)
        # Event handlers
        self.btn_open = tk.Button(self.frame_buttons, text="Open", command=self.controller.openFile)
        self.btn_search = tk.Button(self.frame_buttons, text="Search", command=self.controller.findValue)
        self.btn_statistics = tk.Button(self.frame_buttons, text="Statistics", command=self.controller.getMinMax)
        self.btn_plot = tk.Button(self.frame_buttons, text="Show plot", command=self.controller.openPlot)

        # Grid setup
        self.btn_open.grid(row=0, column=0, sticky="ew", padx=5, pady=5)
        self.btn_search.grid(row=1, column=0, sticky="ew", padx=5, pady=5)
        self.btn_statistics.grid(row=2, column=0, sticky="ew", padx=5, pady=5)
        self.btn_plot.grid(row=3, column=0, sticky="ew", padx=5, pady=5)

        self.frame_buttons.pack(side=tk.LEFT, fill=tk.BOTH)

        #Window setup
        self.root.rowconfigure(0, minsize=800, weight=1)
        self.root.columnconfigure(1, minsize=800, weight=1)
        self.root.title("Log viewer")
コード例 #8
0
 def read_csv(self):
     #reads csv and displays table using tkintertable
     self.tframe = Frame(self.window)
     self.tframe.place(x=1200, y=350, width=600)
     self.table = TableCanvas(self.tframe)
     self.table.importCSV(self.csv_path)
     self.table.show()
コード例 #9
0
    def conv_to_csv(self):
        self.f = Frame(root, height=300, width=300)
        self.f.pack(fill=BOTH, expand=1)

        self.table = TableCanvas(self.f, read_only=True)
        self.table.importCSV('empsal.csv')
        self.table.show()
コード例 #10
0
class create_csv():
    def __init__(self, root):
        self.f = Frame(root, height=500, width=500)
        self.f.pack()

        self.message_label = Label(self.f,
                                   text='Display the Empsal CSV:',
                                   font=('Roman', 24, 'bold'),
                                   fg='navy blue')
        self.confirm_button = Button(self.f,
                                     text='Display',
                                     font=('Arial', 14),
                                     bg='light green',
                                     fg='White',
                                     command=self.conv_to_csv,
                                     activeforeground='green')
        self.exit_button = Button(self.f,
                                  text='Exit',
                                  font=('Arial', 14),
                                  bg='pink',
                                  fg='White',
                                  command=root.destroy,
                                  activeforeground='red')

        self.message_label.grid(row=1, column=1)
        self.confirm_button.grid(row=3, column=0)
        self.exit_button.grid(row=3, column=2)

    def conv_to_csv(self):
        self.f = Frame(root, height=300, width=300)
        self.f.pack(fill=BOTH, expand=1)

        self.table = TableCanvas(self.f, read_only=True)
        self.table.importCSV('empsal.csv')
        self.table.show()
コード例 #11
0
    def redraw_tables(self):
        try:
            # The data from th API.
            request = requests.get("http://127.0.0.1:8000/products/",
                                   auth=("gabriel", "1"))

            # Transform the API's data to the TableCanvas' form.
            # Use the unique index for the rows in the TableCanvas.
            data = {}
            for i in request.json():
                data[request.json().index(i)] = i

            # Create a new frame for the TableCanvas.
            tframe = ttk.Frame(self)
            tframe.grid(row=1, columnspan=4, padx=10, pady=10)
            self.table = TableCanvas(
                tframe,
                data=data,
                read_only=True,
                width=1300,
                height=600,
                cellwidth=325,
                rowheight=40,
                rowheaderwidth=60,  # To hide; set value to 0.
                rowselectedcolor=None,  # Get rid of the row selection.
                selectedcolor=None,  # Get rid of the cell selection.
                thefont=('Arial', 15),
            )
            self.table.show()
        except:
            messagebox.showerror("API Error", "The api isn't running.")
コード例 #12
0
 def redraw_tables(self):
     # Create a new frame for the TableCanvas.
     tframe = ttk.Frame(self)
     tframe.grid(row=1, columnspan=4, padx=10, pady=10)
     self.table = TableCanvas(
         tframe,
         data={
             1: {
                 "name": "",
                 "amount": "",
                 "barcode": "",
                 "price_piece": ""
             }
         },
         width=1300,
         height=600,
         cellwidth=325,
         rowheight=40,
         rowheaderwidth=60,  # To hide; set value to 0.
         read_only=True,
         rowselectedcolor=None,  # Get rid of the row selection.
         selectedcolor=None,  # Get rid of the cell selection.
         thefont=('Arial', 14),
     )
     self.table.show()
コード例 #13
0
    def initFrame(self):
        # *****界面区*****
        # 布局参数
        params = ['row','column','rowspan','columnspan']
        gridMap =  {'label':(0,0),
                'entry':(0,1),
                'search_button':(0,2),
                'table':(1,1,None,3),
                'next_page':(2,1),
                'modify':(2,2),
                'corfirm':(2,3)}
        cnfs = {}
        for k,vals in gridMap.items():
            dic = {}
            for i,v in enumerate(vals):
                dic[params[i]] = v
            cnfs[k] = dic
        ttk.Label(self, text='搜索', style="BW.TLabel").grid(cnfs['label'])

        self.keyword = tk.StringVar()   # 搜索框
        tk.Entry(self, borderwidth=3, width=40, textvariable=self.keyword, selectbackground='gray').grid(cnfs['entry'])
        ttk.Button(self, text='搜索', command="", width=9).grid(cnfs['search_button'])
        frame = tk.Frame(self)
        frame.grid(cnfs['table'])
        model = TableModel()
        self.table = TableCanvas(frame,model)
        self.table.show()
        ttk.Button(self, text='下一页', command="", width=9).grid(cnfs['next_page'])
        ttk.Button(self, text='设为组合', command=self.set_combo, width=9).grid(cnfs['next_page'],sticky=tk.E)
        ttk.Button(self, text='修改', command=self.modify, width=9).grid(cnfs['modify'])
        ttk.Button(self, text='选择', command=self.choic, width=9).grid(cnfs['corfirm'])
コード例 #14
0
ファイル: tkinterTableDemo.py プロジェクト: sdyz5210/python
def demo2(root):
    frame = Frame(root)
    frame.pack()
    model = TableModel()
    model.importDict(data)
    table = TableCanvas(frame, model=model)
    table.createTableFrame()
コード例 #15
0
class create_csv:

     def __init__(self, root):
          self.f = Frame(root, height=350, width=500)
          self.f.pack()    # Place the frame on root window

          # Creating label widgets
          self.message_label = Label(self.f,text='Display the Empsal CSV in TkinterTable',font=('Arial', 14))

          # Buttons
          self.confirm_button = Button(self.f,text='Display', font=('Arial', 14), bg='Orange',
                                 fg='Black', command=self.conv_to_csv)
          self.exit_button = Button(self.f,text='Exit', font=('Arial', 14), bg='Yellow',
                                 fg='Black', command=root.destroy)

          # Placing the widgets using grid manager
          self.message_label.grid(row=1, column=0)
          self.confirm_button.grid(row=2,column=0)
          self.exit_button.grid(row=2,column=2)

     def conv_to_csv(self):

         try:

             # Now display the CSV in 'tkintertable' widget
             self.f = Frame(root, height=200, width=300)
             self.f.pack(fill=BOTH,expand=1)
             self.table = TableCanvas(self.f, read_only=True)
             self.table.importCSV('empsal.csv')
             self.table.show()

         except FileNotFoundError as e:
             msg.showerror('Error in opening file', e.msg)
コード例 #16
0
        def __init__(self,tktk = None,
                        br_image = None,
                        pathico = None,
                        br_image_path = None):

                Frame.__init__(self, tktk)
                self.tktk = tktk

                self.br_image_path  = br_image_path

                self.br_image = br_image

                self.pathico = pathico

                self.filewin = Toplevel(self.tktk)

                gui (tktk=self.filewin,
                        pathico=self.pathico,
                        width=1280,
                        height=1024,
                        widthx=300,
                        widthy=0,
                        resizable=[True,True]).setcfbs()
                        
                # set data
                data = createData()
                menu (tktk=self.filewin).createmenu()

                #create label 
                self.framelb = Frame(self.filewin,bg = "slate gray")
                self.framelb.pack(side = TOP)

                #creare frame for infomation
                self.frameinfor = Frame(self.filewin,bg = "slate gray")
                self.frameinfor.pack(side = TOP)


                #create title 
                self.framett = Frame(self.filewin,bg = "slate gray")
                self.framett.pack(side = TOP)

                # creare frame for table  
                self.tframe = Frame(self.filewin)
                self.tframe.pack(fill = X,side = TOP)

                model = TableModel()
                table = TableCanvas(self.tframe, model=model,data=data,height=650)
                table.show()

               #update quotation
                self.frameupdate = Frame(self.filewin,bg = "slate gray")
                self.frameupdate.pack(side = TOP)
                
                # import and export excel 
                self.frameimeex = Frame(self.filewin,bg = "slate gray")
                self.frameimeex.pack(side = TOP)


                self.createguiin()
コード例 #17
0
def table_gui(data):
    tframe = Frame(master)
    tframe.pack()
    table = TableCanvas(tframe)
    table.show()


#if __name__ == '__main__': main()
コード例 #18
0
 def __init__(self, root):
     self.f = Frame(root, height=200, width=300) 
     self.f.pack(fill=BOTH,expand=1)
     
     self.table = TableCanvas(self.f, read_only=True)
     self.table.importCSV('exp_sal.csv')
     print (self.table.model.columnNames)
     self.table.show()
コード例 #19
0
ファイル: CustomTable.py プロジェクト: Unn20/ZBD_app
 def __init(self, parent=None, model=None):
     TableCanvas.__init__(read_only=False,
                          cellwidth=60,
                          cellbackgr='#e3f698',
                          thefont=('Arial', 12),
                          rowheight=20,
                          rowheaderwidth=30,
                          rowselectedcolor='yellow',
                          editable=True)
     return
コード例 #20
0
def ClearTable():

    DataTracking.Question = []
    DataTracking.Answers = []
    DataTracking.Correct = []

    Data = {}
    model = TableModel()
    table = TableCanvas(tframe, data=Data)
    table.show()
コード例 #21
0
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.configure(width=1250, height=500)

        self.frCal = Frame(self)
        self.frCal.place(relx=0, rely=0)
        self.frCal.configure(bd=1, relief=RAISED)
        self.calWidget = tkcalendar.Calendar(self.frCal,
                                             showweeknumbers=False,
                                             locale="ru_RU",
                                             maxdate=self.today)
        self.calWidget.pack()
        self.calWidget.bind('<<CalendarSelected>>', self.getDate)

        self.dayDataFrame = Frame(self)
        self.dayDataFrame.grid_propagate(0)
        self.dayDataFrame.place(relx=0, rely=1, anchor=SW)
        self.dayDataFrame.configure(width=1250,
                                    height=300,
                                    bd=1,
                                    relief=RAISED)

        self.tableModel = TableModel()
        self.table = TableCanvas(self.dayDataFrame,
                                 cellwidth=300,
                                 model=self.tableModel,
                                 rowheight=25)
        self.table.show()

        self.drawFrame = Frame(self)
        self.drawFrame.grid_propagate(0)
        self.drawFrame.place(relx=1, rely=0, anchor=NE)
        self.drawFrame.configure(width=966, height=200, bd=1, relief=RAISED)

        self.createCanvas()

        self.dateList = []
        self.hourUsed = [0 for i in range(24)]

        self.strInfo = StringVar()
        self.labelInfo = Label(self,
                               textvariable=self.strInfo,
                               width=30,
                               height=1,
                               bg='white',
                               bd=1,
                               relief=RAISED,
                               font='Arial 10')
        self.strInfo.set('Test')
        self.labelInfo.place(x=0, y=175)

        self.createFileList()
        self.createTable()
        self.readReportFile(self.today)
コード例 #22
0
 def __init__(self, parent=None):
     self.parent = parent
     Frame.__init__(self)
     self.main = self.master
     self.main.geometry('800x500+0+0')
     self.main.title('Sequences of Shifts')
     f = Frame(self.main)
     f.pack(fill=BOTH,expand=1)
     self.table = TableCanvas(f, data=data, cellwidth=150, cellbackgr='#E3F6CE',read_only=True,rowselectedcolor='yellow',rowheaderwidth=100,showkeynamesinheader=True)
     self.table.show()
     return
コード例 #23
0
def LoadWebPage():

    HtmlFile = filedialog.askopenfilename()
    File = open(HtmlFile, encoding='utf-8')
    soup = BeautifulSoup(File.read(), features="html.parser")
    Data = GetQuestions.GetAnswers(soup)

    model = TableModel()
    table = TableCanvas(tframe, data=Data)
    table.thefont = ('Arial', 10)
    table.show()
コード例 #24
0
ファイル: tkinterTableDemo.py プロジェクト: sdyz5210/python
def demo5(root):
    frame = Frame(root)
    frame.pack()
    table = TableCanvas(frame,
                        rowheaderwidth=0,
                        cellwidth=150,
                        rowheight=20,
                        editable=False,
                        rowselectedcolor='red',
                        reverseorder=1)
    table.createTableFrame()
コード例 #25
0
ファイル: sal.py プロジェクト: Shrivas-7/SalaryPrediction_LR
        def conv_to_csv(self):

            try:

                # Now display the CSV in 'tkintertable' widget
                self.f = Frame(root, height=200, width=300)
                self.f.pack(fill=BOTH, expand=1)
                self.table = TableCanvas(self.f, read_only=True)
                self.table.importCSV('exp_sal.csv')
                self.table.show()
            except FileNotFoundError as e:
                msg.showerror('Error in opening file', e.msg)
 def display_excel(self):
     try:
         stock_price_df=pd.read_excel('E:\project5\stock_price.xls', sheet_name='Stock')
         stock_price_df.to_csv('E:\project5\stock_price.csv', index=False)
         
         # Now display the csv in 'tkintertable' widget
         self.f= Frame(root,height=200 , width=300)
         self.f.pack(fill=BOTH, expand=1)
         self.table= TableCanvas(self.f , read_only=True)
         self.table.importCSV('E:\project5\stock_price.csv')
         #print(self.table.mode1.columnNames)# to print column names in IDLE shell
     except FileNotFoundError as e:
         print(e)
コード例 #27
0
 def __init__(self, parent=None):
     self.parent = parent
     Frame.__init__(self)
     self.main = self.master
     self.main.geometry('800x500+200+100')
     self.main.title(weather)
     f = Frame(self.main)
     f.pack(fill=BOTH, expand=1)
     table = TableCanvas(f, data=data2)
     # table.redrawTable()
     # table.model.data[0]['col1'] = 'XX'
     # print(table.model.columnNames)
     table.show()
     return
コード例 #28
0
class App(Frame):
    """Basic test frame for the table"""
    data = {}
    table = TableCanvas

    def __init__(self, parent=None):

        self.table = TableCanvas
        self.parent = parent
        Frame.__init__(self)
        self.main = self.master
        self.main.title('Test')
        # Initialize frame for the table
        #f = Frame(self.main)

        # Initialize the grid location of the table
        #f.grid(row=0, column=1, sticky="nsew")

        # no need to pack since we using grid geometry
        # f.pack(fill=tk.Y,expand=-1,side = tk.LEFT)

        # Create/Format table
        #table = TableCanvas(f, cellwidth=60, data = test, cellbackgr='white', thefont=('Arial',12),rowheight=25, rowheaderwidth=30, rowselectedcolor='yellow', editable=True)

        #Import table from csv
        #table.importCSV('2017_Traffic_Volume_Flow.csv')
        """if importing table as dictionary, use this: data is of type dictionary
        """
        # table = TableCanvas(f, cellwidth=60, data = data, cellbackgr='white',
        #                    thefont=('Arial', 12), rowheight=25, rowheaderwidth=30,
        #                    rowselectedcolor='yellow', editable=True)

        #print (table.model.columnNames)
        #table.show()
        # sort the first column from highest to lowest (the sum of incident column)
        # table.sortTable(reverse=1)

        return

    def importData(self, dataImport):
        data = dataImport
        model = TableModel()
        model.importDict(data)
        f = Frame(self.main)
        self.table = TableCanvas(f,
                                 model,
                                 cellwidth=60,
                                 cellbackgr='white',
                                 thefont=('Arial', 12),
                                 rowheight=25,
                                 rowheaderwidth=30,
                                 rowselectedcolor='yellow',
                                 editable=True)
        self.table.createTableFrame()
        self.table.show()
        f.grid(row=0, column=1, sticky="nsew")

    def sortData(self, l, c):
        self.table.sortTable(reverse=l, columnIndex=c)
        self.table.redraw()
コード例 #29
0
def show_transaction_table(frame, frame1):
    model = TableModel()
    transactionItems = transactions_database.getData()

    data = {}
    data1 = {}

    totalSale = 0.0

    for i in range(len(transactionItems)):
        totalSale += float(transactionItems[i][1])

    for i in range(len(transactionItems)):
        data['row' + str(i + 1)] = {
            'Name': transactionItems[i][0],
            'S.Price': transactionItems[i][1],
            'Date': transactionItems[i][2]
        }

        data1['row1'] = {'Total ($)': totalSale}

        table1 = TableCanvas(frame1, data=data1, takefocus=0)
        table = TableCanvas(frame, data=data, takefocus=0)

        table.show()
        table1.show()
コード例 #30
0
ファイル: tkinterTableDemo.py プロジェクト: sdyz5210/python
def demo4(root):
    frame = Frame(root)
    frame.pack()
    model = TableModel()
    model.importDict(data)
    table = TableCanvas(frame,
                        model=model,
                        rowheaderwidth=0,
                        cellwidth=150,
                        rowheight=20,
                        editable=False,
                        rowselectedcolor='red',
                        reverseorder=1)
    table.createTableFrame()
コード例 #31
0
ファイル: gui.py プロジェクト: systemsera/battleship
 def drawEnemyFleetTable(self):
     self.model = TableModel()
     self.table = TableCanvas(self.EnemyFleet,
                              model=self.model,
                              cellwidth=50,
                              cellbackgr='white',
                              thefont=self.tkFont,
                              rowheight=16,
                              editable=True,
                              rowselectedcolor='white',
                              reverseorder=1)
     self.table.createTableFrame()
     self.table.model.columnNames = ['A', 'B', 'C', 'D', 'E']
     self.table.redrawTable
     self.iniEnemyFleet()
コード例 #32
0
 def __init__(self, parent=None):
     self.parent = parent
     Frame.__init__(self)
     self.main = self.master
     self.main.geometry('800x500+200+100')
     self.main.title('Test')
     f = Frame(self.main)
     f.pack(fill=BOTH, expand=1)
     table = TableCanvas(f, data=data)
     # table.importCSV('test.csv')
     print(table.model.columnNames)
     # table.model.data[1]['a'] = 'XX'
     # table.model.setValueAt('YY',0,2)
     table.show()
     return
コード例 #33
0
ファイル: description_dialog.py プロジェクト: anddrrw/maskgen
 def __init__(self, parent=None, model=None, width=None, height=None, openColumn=None, dir='.',**kwargs):
     self.openColumn = openColumn
     self.dir = dir
     TableCanvas.__init__(self,parent=parent,model=model,width=width,height=height,**kwargs)
コード例 #34
0
    data = obj.transfer_data(table.model.data)
    obj.bfs(top, data)

    print_output_log(obj, lable_bfs_result)

root = Tk()
font_style = tkFont.Font(family='Monospaced', size=9)
root.title(string='Lab 1 - Workarounds graphs')
root.maxsize(width=555, height=580)
root.minsize(width=555, height=580)

tframe = Frame(master=root)
tframe.grid(column=0, row=0, padx=5, pady=5)

table = TableCanvas(tframe, rows=1, cols=3)
table.createTableFrame()

add_row_button = Button(text='Add row', command=table.addRow, font=font_style)
delete_row_button = Button(text='Delete row', command=table.deleteRow, font=font_style)

dfs_result_button = Button(text='DFS', command=dfs_results, font=font_style)
bfs_result_button = Button(text='BFS', command=bfs_results, font=font_style)

starting_vertex = Entry(root)
lable = Label(root, text='Starting vertex:', font=font_style)

lable_dfs_result = Listbox(root)
lable_bfs_result = Listbox(root)

lable.grid(column=0, row=1, padx=5, pady=5, sticky=W)
コード例 #35
0
ファイル: caritas.py プロジェクト: rached193/Caritas
    def initUI(self):

        self.parent.title("Caritas")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        frameMenu = Frame(self)
        frameMenu.pack(fill="both", expand="0", side=RIGHT)

        labelBusqueda = LabelFrame(frameMenu, text="Busqueda")
        labelBusqueda.pack(fill="x",expand =1)

        labelVoluntarios = LabelFrame(frameMenu)
        labelVoluntarios.pack(fill="both",expand =0)

        frameTabla = Frame(self)
        frameTabla.pack(fill="both", expand="1", side=LEFT)

        labelTabla = LabelFrame(frameTabla)
        labelTabla.pack(fill="both", expand="1")

        labelBotonera = LabelFrame(frameTabla)
        labelTabla.pack(fill="both", expand="1")

        labelSelect = LabelFrame(frameTabla)
        labelSelect.pack(fill="both", expand="1")

        model = TableModel()
        modelSelect = TableModel()

        model.addColumn("nombre")
        model.addColumn("apellidos")
        model.addColumn("dni")
        model.addColumn("direccion")
        model.addColumn("correo_electronico")
        model.addColumn("estudio")
        model.addColumn("parroquial")
        model.addColumn("proyecto")
        model.addColumn("genero")
        model.addColumn("fecha_nacimiento")
        model.addColumn("telefono_1")
        model.addColumn("telefono_2")

        modelSelect.addColumn("nombre")
        modelSelect.addColumn("apellidos")
        modelSelect.addColumn("dni")
        modelSelect.addColumn("direccion")
        modelSelect.addColumn("correo_electronico")
        modelSelect.addColumn("estudio")
        modelSelect.addColumn("parroquial")
        modelSelect.addColumn("proyecto")
        modelSelect.addColumn("genero")
        modelSelect.addColumn("fecha_nacimiento")
        modelSelect.addColumn("telefono_1")
        modelSelect.addColumn("telefono_2")

        #Tabla Voluntarios
        self.listilla= queryAllVoluntarios()
        model.importDict(self.listilla)
        self.table = TableCanvas(labelTabla, model=model,editable=False)
        self.table.createTableFrame()
        self.table.handle_double_click(self.eventoClic)

        #Tabla Seleccionados
        self.selectTable = TableCanvas(labelSelect, model=modelSelect,editable=False)
        self.selectTable.createTableFrame()
        self.listadoSeleccionado = []

        L1 = Label(labelBusqueda, text="Nombre")
        L1.pack()
        E1 = Entry(labelBusqueda)
        E1.pack()

        L2 = Label(labelBusqueda, text="Apellidos")
        L2.pack()
        E2 = Entry(labelBusqueda)
        E2.pack()

        botonArriba = Button(labelVoluntarios, text="Agregar al listado",  command=lambda:self.agregarListado(self.table.getSelectedRow()))
        botonArriba.pack()
        botonAbajo = Button(labelVoluntarios, text="Quitar del listado",  command=lambda:self.quitarListado(self.selectTable.getSelectedRow()))
        botonAbajo.pack()

        button = Button(labelBusqueda, text="Buscar", command=lambda: self.buscar(E1.get(),E2.get()))
        button.pack()

        button = Button(labelVoluntarios, text="Nuevo Voluntario",  command=lambda:self.ventanaVoluntarios(-1))
        button.pack()

        buttonEditar = Button(labelVoluntarios, text="Editar Voluntario",  command=lambda:self.ventanaVoluntarios(self.table.getSelectedRow()))
        buttonEditar.pack()

        buttonImprimir = Button(labelVoluntarios, text="Imprimir",  command=lambda:self.ventanaImprimir())
        buttonImprimir.pack()
コード例 #36
0
ファイル: caritas.py プロジェクト: rached193/Caritas
class Example(Frame):
    counter = 0

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def nuevoVoluntario(self, nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id,
                        parroquial_id, proyecto_id, telefono_1, telefono_2, genero, fecha_nacimiento,t,estado,id):
        global cnx
        cursor = cnx.cursor()
        if estado:
            query = (
                "INSERT INTO caritas.voluntario (nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id, parroquial_id, proyecto_id, telefono_1, telefono_2, genero, fecha_nacimiento) VALUES ('%s','%s','%s','%s','%s','%d','%d','%d','%d','%s','%s','%s','%s')" % (
                    nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id, parroquial_id,
                    proyecto_id,
                    telefono_1, telefono_2, genero, fecha_nacimiento))
        else:
            query = (
                "UPDATE caritas.voluntario SET nombre = ('%s'), apellidos = ('%s'), dni = ('%s'), direccion = ('%s'), correo_electronico = ('%s'), localidad_id = ('%d'), estudio_id = ('%d'), parroquial_id = ('%d'),proyecto_id = ('%d'), telefono_1 = ('%s'), telefono_2 = ('%s'), genero = ('%s'), fecha_nacimiento = ('%s') WHERE id = ('%d')"
                % ( nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id, parroquial_id,proyecto_id, telefono_1, telefono_2, genero, fecha_nacimiento,id))
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        t.destroy()

    def getEstudios(self):
        global cnx
        cursor = cnx.cursor(dictionary=True)
        query = ("SELECT * FROM estudio e")
        cursor.execute(query)
        valores = []
        strings = []
        for row in cursor:
            valores.append(row['id'])
            strings.append(row['nombre'])

        cursor.close()
        self.listadoEstudios = [strings, valores]

    def getParroquial(self):
        global cnx
        cursor = cnx.cursor(dictionary=True)
        query = ("SELECT * FROM parroquial e")
        cursor.execute(query)
        valores = []
        strings = []
        for row in cursor:
            valores.append(row['id'])
            strings.append(row['nombre'])

        cursor.close()
        self.listadoParroquial = [strings, valores]

    def getPais(self):
        global cnx
        cursor = cnx.cursor(dictionary=True)
        query = ("SELECT * FROM pais e")
        cursor.execute(query)
        valores = []
        strings = []
        for row in cursor:
            valores.append(row['id'])
            strings.append(row['nombre'])

        cursor.close()
        self.listadoPais = [strings, valores]

    def nuevoEstudio(self):
        t = Toplevel(self)
        t.wm_title("Estudio")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.grid(row=1, column=1)

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.nuevaEntradaEstudios(E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarEstudios(E2.get(), t))
        button3.config(state="disabled")

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def nuevoPais(self):
        t = Toplevel(self)
        t.wm_title("Pais")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.grid(row=1, column=1)

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.nuevaEntradaPais(E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarPais(E2.get(), t))
        button3.config(state="disabled")

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def nuevaParroquia(self):
        t = Toplevel(self)
        t.wm_title("Parroquial")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.grid(row=1, column=1)

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.nuevaEntradaParroquia(E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarParroquial(E2.get(), t))
        button3.config(state="disabled")

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def editarEstudio(self):
        t = Toplevel(self)
        t.wm_title("Estudio")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.insert(END, self.selectorEstudios.get())
        E2.grid(row=1, column=1)

        nombreOld = self.selectorEstudios.get()


        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.actualizarEstudio(nombreOld, E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarEstudios(E2.get(), t))

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def editarPais(self):
        t = Toplevel(self)
        t.wm_title("Pais")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.insert(END, self.selectorPais.get())
        E2.grid(row=1, column=1)

        nombreOld = self.selectorPais.get()

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.actualizarPais(nombreOld, E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarPais(E2.get(), t))

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def editarParroquia(self):
        t = Toplevel(self)
        t.wm_title("Estudio")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.insert(END, self.selectorParroquial.get())
        E2.grid(row=1, column=1)

        nombreOld = self.selectorParroquial.get()

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.actualizarParroquia(nombreOld, E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarParroquial(E2.get(), t))

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)

    def actualizarPais(self, nombreOld, nombreN, t):
        global cnx
        cursor = cnx.cursor()
        query = ("UPDATE caritas.pais SET nombre= ('%s') WHERE nombre = ('%s')" % (nombreN, nombreOld))
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getPais()
        self.selectorPais['values'] = self.listadoPais[0]

        t.destroy()

    def actualizarEstudio(self, nombreOld, nombreN, t):
        global cnx
        cursor = cnx.cursor()
        query = ("UPDATE caritas.estudio SET nombre= ('%s') WHERE nombre = ('%s')" % (nombreN, nombreOld))
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getEstudios()
        self.selectorEstudios['values'] = self.listadoEstudios[0]

        t.destroy()

    def actualizarParroquia(self, nombreOld, nombreN, t):
        global cnx
        cursor = cnx.cursor()
        query = ("UPDATE caritas.parroquial SET nombre= ('%s') WHERE nombre = ('%s')" % (nombreN, nombreOld))
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getParroquial()
        self.selectorParroquial['values'] = self.listadoParroquial[0]

        t.destroy()

    def BorrarEstudios(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("DELETE FROM caritas.estudio WHERE nombre = ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getEstudios()
        self.selectorEstudios['values'] = self.listadoEstudios[0]

        t.destroy()

    def BorrarPais(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("DELETE FROM caritas.pais WHERE nombre = ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getPais()
        self.selectorPais['values'] = self.listadoPais[0]

        t.destroy()

    def BorrarParroquial(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("DELETE FROM caritas.parroquial WHERE nombre = ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getParroquial()
        self.selectorParroquial['values'] = self.listadoParroquial[0]

        t.destroy()

    def nuevaEntradaEstudios(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("INSERT INTO caritas.estudio (nombre) VALUE ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getEstudios()
        self.selectorEstudios['values'] = self.listadoEstudios[0]

        t.destroy()

    def nuevaEntradaPais(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("INSERT INTO caritas.pais (nombre) VALUE ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getPais()
        self.selectorPais['values'] = self.listadoPais[0]

        t.destroy()

    def nuevaEntradaParroquia(self, nombre, t):
        global cnx
        cursor = cnx.cursor()
        query = ("INSERT INTO caritas.parroquial (nombre) VALUE ('%s')" % nombre)
        cursor.execute(query)
        cnx.commit()
        cursor.close()

        self.getParroquial()
        self.selectorParroquial['values'] = self.listadoParroquial[0]

        t.destroy()

    def ventanaVoluntarios(self,row):

        id = -1
        guardar = TRUE
        # Creamos una ventana nueva
        t = Toplevel(self)
        t.wm_title("Crear Voluntario")

        # Etiqueta y entrada de nombre
        Label(t, text="Nombre").grid(row=0)
        entradaNombre = Entry(t)
        entradaNombre.grid(row=0, column=1,sticky = "ew")

        # Etiqueta y entrada de apellidos
        Label(t, text="Apellidos").grid(row=1)
        entradaApellidos = Entry(t)
        entradaApellidos.grid(row=1, column=1,sticky = "ew")

        # Etiqueta y entrada de DNI
        Label(t, text="DNI").grid(row=2)
        entradaDNI = Entry(t)
        entradaDNI.grid(row=2, column=1,sticky = "ew")

        # Etiqueta y entrada de Dirreccion
        Label(t, text="Direccion").grid(row=3)
        entradaDireccion = Entry(t)
        entradaDireccion.grid(row=3, column=1)

        # Etiqueta y seleccion de Estudios
        Label(t, text="Estudios").grid(row=4)
        box_value = StringVar()
        self.getEstudios()
        self.selectorEstudios = Combobox(t, textvariable=box_value, state='readonly')
        self.selectorEstudios['values'] = self.listadoEstudios[0]
        self.selectorEstudios.configure(width=25)
        self.selectorEstudios.current(0)
        self.selectorEstudios.grid(row=4, column=1)

        botonEditarEstudios = Button(t, text="Editar", command=self.editarEstudio)
        botonNuevosEstudios = Button(t, text="Nuevo", command=self.nuevoEstudio)
        botonEditarEstudios.grid(row=4, column=2)
        botonNuevosEstudios.grid(row=4, column=3)

        # Etiqueta y seleccion de Genero
        Label(t, text="Genero").grid(row=5)
        seleccionGenero = Combobox(t, values=["Masculino (M)", "Femenino (F)"], state='readonly')
        seleccionGenero.grid(row=5, column=1)

        # Etiqueta y seleccion de Parroquial
        Label(t, text="Parroquial").grid(row=6)
        box_value = StringVar()
        self.getParroquial()
        self.selectorParroquial = Combobox(t, textvariable=box_value, state='readonly')
        self.selectorParroquial['values'] = self.listadoParroquial[0]
        self.selectorParroquial.configure(width=25)
        self.selectorParroquial.current(0)
        self.selectorParroquial.grid(row=6, column=1)

        botonEditarParroquial = Button(t, text="Editar", command=self.editarParroquia)
        botonNuevaParroqual = Button(t, text="Nuevo", command=self.nuevaParroquia)
        botonEditarParroquial.grid(row=6, column=2)
        botonNuevaParroqual.grid(row=6, column=3)

        # Etiqueta y seleccion de Correo
        Label(t, text="Correo").grid(row=0, column=4)
        entradaCorreo = Entry(t)
        entradaCorreo.grid(row=0, column=5)

        Label(t, text="Telefono 1").grid(row=1, column=4)
        entradaTelefono1 = Entry(t)
        entradaTelefono1.grid(row=1, column=5)

        Label(t, text="Telefono 2").grid(row=2, column=4)
        entradaTelefono2 = Entry(t)
        entradaTelefono2.grid(row=2, column=5)

        # Etiqueta y entrada de Fecha
        Label(t, text="Fecha").grid(row=3, column=4)
        entradaAno = Entry(t)
        entradaMes = Entry(t)
        entradaDia = Entry(t)
        entradaAno.grid(row=3, column=5)
        entradaMes.grid(row=3, column=6)
        entradaDia.grid(row=3, column=7)

        # Etiqueta y seleccion de Pais
        Label(t, text="Pais").grid(row=4, column=4)
        box_value = StringVar()
        self.getPais()
        self.selectorPais = Combobox(t, textvariable=box_value, state='readonly')
        self.selectorPais['values'] = self.listadoPais[0]
        self.selectorPais.configure(width=25)
        self.selectorPais.current(0)
        self.selectorPais.grid(row=4, column=5)

        botonEditarPais = Button(t, text="Editar", command=self.editarPais)
        botonNuevaPais = Button(t, text="Nuevo", command=self.nuevoPais)
        botonEditarPais.grid(row=4, column=6)
        botonNuevaPais.grid(row=4, column=7)

        #Rellenamos los cambos si estamos editando
        if row > -1:
            voluntario = self.table.model.getRecordAtRow(row)
            entradaNombre.insert(END,voluntario['nombre'])
            entradaApellidos.insert(END,voluntario['apellidos'])
            entradaCorreo.insert(END,voluntario['correo_electronico'])
            entradaTelefono1.insert(END,voluntario['telefono_1'])
            entradaTelefono2.insert(END,voluntario['telefono_2'])
            entradaDireccion.insert(END,voluntario['direccion'])
            entradaDNI.insert(END,voluntario['dni'])
            self.selectorEstudios.set(voluntario['estudio'])
            self.selectorParroquial.set(voluntario['parroquial'])
            guardar = FALSE
            id = voluntario['id']





        button5 = Button(t, text="Guardar", command=lambda: self.nuevoVoluntario(entradaNombre.get(),
                                                                                 entradaApellidos.get(),entradaDNI.get(),entradaDireccion.get(),
                                                                                 entradaCorreo.get(),1,self.listadoEstudios[1][self.selectorEstudios.current()],
                                                                                 self.listadoParroquial[1][self.selectorParroquial.current()],
                                                                                 1,entradaTelefono1.get(),entradaTelefono2.get(),"M","2001-01-01",t,guardar,id))
        button6 = Button(t, text="Cancelar", command=t.destroy)

        button5.grid(row=7, column=4)
        button6.grid(row=7, column=5)


    def validarVoluntario(self, nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id,
                        parroquial_id, proyecto_id, telefono_1, telefono_2, genero, fecha_nacimiento,t,estado,id):

        guarda = True
        error = ""

        if len(nombre)<3 :
            error = error + "Nombre debe tener mas de 2 caracteres\n"
            guarda = False

        if len(apellidos)<3 :
            error = error + "Apellidos debe tener mas de 2 caracteres\n"
            guarda = False

        if len(dni)==9 and dni[8].isalpha() and dni[0-7].isdigit():
            error = error + "Dni tiene el formato NNNNNNNNX donde N es un digito y X una letra \n"
            guarda = False

        if len(direccion)==0:
            error = error + "Introduzca una Dirección \n"
            guarda = False

        if len(correo_electronico)<5:
            error = error + "Introduzca una dirección de correo valida \n"
            guarda = False


        if len(telefono_1)<9:
            error = error + "Introduzca un numero valido \n"
            guarda = False

        if len(telefono_1)==0:
            telefono_1=0

        if guarda:self.nuevoVoluntario(nombre, apellidos, dni, direccion, correo_electronico, localidad_id, estudio_id,
                        parroquial_id, proyecto_id, telefono_1, telefono_2, genero, fecha_nacimiento,t,estado,id)
        # añadir el error
        else:
            print error

    def ventanaImprimir(self):
        t = Toplevel(self)
        t.wm_title("Imprimir")

        Label(t, text="Numero de Copias por etiqueta").pack()
        w = Spinbox(t, from_=1, to=10)
        w.pack()

        buttonImprimir = Button(t, text="Imprimir",  command=lambda:self.imprimir(int(w.get()),t))
        buttonImprimir.pack()

    def agregarListado(self,numero):
        voluntario = self.table.model.getRecordAtRow(numero)
        modelNuevo = TableModel()

        modelNuevo.addColumn("nombre")
        modelNuevo.addColumn("apellidos")
        modelNuevo.addColumn("dni")
        modelNuevo.addColumn("direccion")
        modelNuevo.addColumn("correo_electronico")
        modelNuevo.addColumn("estudio")
        modelNuevo.addColumn("parroquial")
        modelNuevo.addColumn("proyecto")
        modelNuevo.addColumn("genero")
        modelNuevo.addColumn("fecha_nacimiento")
        modelNuevo.addColumn("telefono_1")
        modelNuevo.addColumn("telefono_2")

        arrayListado = self.selectTable.getModel().data
        valores = {}
        i=1
        for values in arrayListado:
            valores['row',i]=arrayListado['row',i]
            i+=1
        valores['row',i]=voluntario
        modelNuevo.importDict(valores)

        self.selectTable.updateModel(modelNuevo)
        self.selectTable.redrawTable()

    def quitarListado(self,numero):
        voluntario = self.selectTable.model.getRecordAtRow(numero)
        modelNuevo = TableModel()

        modelNuevo.addColumn("nombre")
        modelNuevo.addColumn("apellidos")
        modelNuevo.addColumn("dni")
        modelNuevo.addColumn("direccion")
        modelNuevo.addColumn("correo_electronico")
        modelNuevo.addColumn("estudio")
        modelNuevo.addColumn("parroquial")
        modelNuevo.addColumn("proyecto")
        modelNuevo.addColumn("genero")
        modelNuevo.addColumn("fecha_nacimiento")
        modelNuevo.addColumn("telefono_1")
        modelNuevo.addColumn("telefono_2")

        print numero

        arrayListado = self.selectTable.getModel().data
        valores = {}
        i=1
        for values in arrayListado:
            if numero+1 != i:
                valores['row',i]=arrayListado['row',i]
            i+=1
        modelNuevo.importDict(valores)

        self.selectTable.updateModel(modelNuevo)
        self.selectTable.redrawTable()

    def imprimir(self,numero,label):
        pdf = fpdf.FPDF(format='letter')
        pdf.add_page()
        pdf.set_font("Arial", size=14)

        indice=1
        columna=1
        fila=0
        p=0
        for ficha in self.listadoSeleccionado:
            row = self.listadoSeleccionado['row',indice]
            for x in range(0, numero):
                if p==9:
                    pdf.add_page()
                    p=0
                else:
                    p+=1

                texto = 'Nombre: %s\nApellidos: %s\nDireccion: %s\nTelefono: %s' %(row["nombre"],row["apellidos"],row["direccion"],row["telefono_1"])
                pdf.multi_cell(65, 10,texto,align='C')
                pdf.set_xy(70*columna,60*fila +10)
                columna = columna + 1
                if columna == 4:
                    columna=1
                    fila=fila+1
                    pdf.set_xy(10,60*fila +10)

            indice = indice + 1
        pdf.output("tutorial.pdf")

        label.destroy()

    def buscar(self,nombre,apellidos):

        modelCompleto = TableModel()
        modelNuevo = TableModel()

        modelNuevo.addColumn("nombre")
        modelNuevo.addColumn("apellidos")
        modelNuevo.addColumn("dni")
        modelNuevo.addColumn("direccion")
        modelNuevo.addColumn("correo_electronico")
        modelNuevo.addColumn("estudio")
        modelNuevo.addColumn("parroquial")
        modelNuevo.addColumn("proyecto")
        modelNuevo.addColumn("genero")
        modelNuevo.addColumn("fecha_nacimiento")
        modelNuevo.addColumn("telefono_1")
        modelNuevo.addColumn("telefono_2")

        self.listilla= queryAllVoluntarios()
        modelCompleto.importDict(self.listilla)
        searchterms = [('nombre', nombre, 'contains', 'AND'),('apellidos', apellidos, 'contains', 'AND')]
        result=modelCompleto.getDict(modelCompleto.columnNames, filters=searchterms)
        modelNuevo.importDict(result)
        self.listadoSeleccionado = result
        self.table.updateModel(modelNuevo)
        self.table.redrawTable()

    def eventoClic(self):
        print "Clicado"
        return


    def initUI(self):

        self.parent.title("Caritas")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        frameMenu = Frame(self)
        frameMenu.pack(fill="both", expand="0", side=RIGHT)

        labelBusqueda = LabelFrame(frameMenu, text="Busqueda")
        labelBusqueda.pack(fill="x",expand =1)

        labelVoluntarios = LabelFrame(frameMenu)
        labelVoluntarios.pack(fill="both",expand =0)

        frameTabla = Frame(self)
        frameTabla.pack(fill="both", expand="1", side=LEFT)

        labelTabla = LabelFrame(frameTabla)
        labelTabla.pack(fill="both", expand="1")

        labelBotonera = LabelFrame(frameTabla)
        labelTabla.pack(fill="both", expand="1")

        labelSelect = LabelFrame(frameTabla)
        labelSelect.pack(fill="both", expand="1")

        model = TableModel()
        modelSelect = TableModel()

        model.addColumn("nombre")
        model.addColumn("apellidos")
        model.addColumn("dni")
        model.addColumn("direccion")
        model.addColumn("correo_electronico")
        model.addColumn("estudio")
        model.addColumn("parroquial")
        model.addColumn("proyecto")
        model.addColumn("genero")
        model.addColumn("fecha_nacimiento")
        model.addColumn("telefono_1")
        model.addColumn("telefono_2")

        modelSelect.addColumn("nombre")
        modelSelect.addColumn("apellidos")
        modelSelect.addColumn("dni")
        modelSelect.addColumn("direccion")
        modelSelect.addColumn("correo_electronico")
        modelSelect.addColumn("estudio")
        modelSelect.addColumn("parroquial")
        modelSelect.addColumn("proyecto")
        modelSelect.addColumn("genero")
        modelSelect.addColumn("fecha_nacimiento")
        modelSelect.addColumn("telefono_1")
        modelSelect.addColumn("telefono_2")

        #Tabla Voluntarios
        self.listilla= queryAllVoluntarios()
        model.importDict(self.listilla)
        self.table = TableCanvas(labelTabla, model=model,editable=False)
        self.table.createTableFrame()
        self.table.handle_double_click(self.eventoClic)

        #Tabla Seleccionados
        self.selectTable = TableCanvas(labelSelect, model=modelSelect,editable=False)
        self.selectTable.createTableFrame()
        self.listadoSeleccionado = []

        L1 = Label(labelBusqueda, text="Nombre")
        L1.pack()
        E1 = Entry(labelBusqueda)
        E1.pack()

        L2 = Label(labelBusqueda, text="Apellidos")
        L2.pack()
        E2 = Entry(labelBusqueda)
        E2.pack()

        botonArriba = Button(labelVoluntarios, text="Agregar al listado",  command=lambda:self.agregarListado(self.table.getSelectedRow()))
        botonArriba.pack()
        botonAbajo = Button(labelVoluntarios, text="Quitar del listado",  command=lambda:self.quitarListado(self.selectTable.getSelectedRow()))
        botonAbajo.pack()

        button = Button(labelBusqueda, text="Buscar", command=lambda: self.buscar(E1.get(),E2.get()))
        button.pack()

        button = Button(labelVoluntarios, text="Nuevo Voluntario",  command=lambda:self.ventanaVoluntarios(-1))
        button.pack()

        buttonEditar = Button(labelVoluntarios, text="Editar Voluntario",  command=lambda:self.ventanaVoluntarios(self.table.getSelectedRow()))
        buttonEditar.pack()

        buttonImprimir = Button(labelVoluntarios, text="Imprimir",  command=lambda:self.ventanaImprimir())
        buttonImprimir.pack()