Example #1
0
def demo2(root):
    frame = Frame(root)
    frame.pack()
    model = TableModel()
    model.importDict(data)
    table = TableCanvas(frame, model=model)
    table.createTableFrame()
Example #2
0
    def loginto():
        aa= MySQLdb.connect(host='127.0.0.1',port= 3306,user="******",passwd="010905885",db="kitpage")
        mm = aa.cursor()
        username = e1.get()
        password = e2.get()
        mm.execute('SELECT * FROM singup WHERE username = %s AND passwords = %s', (username, password))
        for i in username:
            print i
        if mm.fetchall():
            tkMessageBox.showinfo("Welcome to %s" %username, "Let GO")
            R.destroy()
            master = Tk()
            tframe = Frame(master)
            tframe.pack()
            table = TableCanvas(tframe)
            table.createTableFrame()

            model = TableModel()adf
            table = TableCanvas(tframe, model=model)


            master.mainloop()

            
            
        else:
            tkMessageBox.showinfo("Sorry" , "Wrong Password")
Example #3
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()
def CreateTable(Main, Data):
    
    tframe = tk.Frame(Main,
                      bg ="blue",
                      highlightcolor = "blue") 
    tframe.place(x = 50, y =275,
                 height = 275, width =1100)
    
    rec, col = Data.shape
    aux = dict()
    data = dict()
    
    for i in range(rec):
        for j in range(col):
            aux [Data.columns[j]] = Data.values[i,j]
        data['rec'+str(i+1)] = aux.copy()
    
    model = TableModel()    
    table = TableCanvas(tframe, cellbackgr='white', 
    			thefont=('Arial',12, ), cellwidth = 100 ,
                rowheight=25, rowheaderwidth=30,
    			rowselectedcolor='yellow', editable=False,
                model = model)
    table.createTableFrame()
    model = table.model
    model.importDict(data)

    table.show()
    return table, model
Example #5
0
def MenuAssignments():
    AssignmentsWindow = tk.Toplevel(window)
    AssignmentsWindow.title("Replenisher Assignments") 
    AssignmentsWindow.geometry('800x500')
    
    UserList = [
    "User Selection", 
    "User1",
    "User2",
    "User3" 
    ] 
    UserVariable = StringVar(AssignmentsWindow)
    UserVariable.set(UserList[0]) # default value 
    UserOptionMenu = tk.OptionMenu(AssignmentsWindow, UserVariable, *UserList)
    UserOptionMenu.pack()
    
    TaskList = [
    "Task Selection", 
    "Task1",
    "Task2",
    "Task3" 
    ] 
    TaskVariable = StringVar(AssignmentsWindow)
    TaskVariable.set(TaskList[0]) # default value 
    TaskOptionMenu = tk.OptionMenu(AssignmentsWindow, TaskVariable, *TaskList)
    TaskOptionMenu.pack()    
    
    def AddUserTask():
        tkMessageBox.showinfo('Add User and Task', "Added User: "******";  " + "Added Task: " + TaskVariable.get() )  
    
    AddUserTaskBT = tk.Button(AssignmentsWindow, text="Add User and Task", command=AddUserTask)
    AddUserTaskBT.pack()
    
    #Add a table 
    '''
    RowNum = 2
    ColNum = 2
    for i in range(RowNum): 
        for j in range(ColNum): 
            b = tk.Entry(AssignmentsWindow, text="")
            b.grid(row=i, column=j)
            b.pack()
    '''
    
    #To use tkintertable  
    tframe = tk.Frame(AssignmentsWindow)
    tframe.pack()  
    model = TableModel()
    table = TableCanvas(tframe, model=model)
    table.createTableFrame()
    
    model = table.model
    data = {'rec1': {'User': '******', 'Task': 'Task1', 'Status': 'Open', 'Rank': 1, 'Priority': 'High', 'Start Time': '05-19-2018 10:30', 'Finish Time': ''},  
            'rec2': {'User': '******', 'Task': 'Task2', 'Status': 'Open', 'Rank': 2, 'Priority': 'Low', 'Start Time': '05-19-2018 11:30', 'Finish Time': '05-19-2018 22:30'},
            'rec3': {'User': '******', 'Task': 'Task3', 'Status': 'Open', 'Rank': 3, 'Priority': 'Low', 'Start Time': '05-19-2018 12:30', 'Finish Time': '05-19-2018 22:45'}               
           }  
    model.importDict(data) #Import from a dictionary to populate model
    table.redrawTable()
    
    AssignmentsWindow.mainloop()
Example #6
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()
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()
  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')
Example #9
0
def demo3(root):
    frame = Frame(root)
    frame.pack()
    model = TableModel()
    model.importDict(data)
    table = TableCanvas(frame, model=model)
    table.createTableFrame()
    table.model.data['rec2']['col2'] = 50
    table.redrawTable()
Example #10
0
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()
Example #11
0
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()
Example #12
0
def viewFreqOutput(event):
    top = Toplevel()
    analysis = {}
    f = open("frequency_output.txt")
    for line in f:
        record = {}
        tokens = line.rstrip('\n').split(' ')
        if tokens[0] not in analysis:
            record["Label"] = tokens[0]
            record["Frequency"] = tokens[1]
            analysis[tokens[0]] = record
    # print(analysis)
    model = TableModel()
    model.importDict(analysis)
    table = TableCanvas(top, model=model)
    table.createTableFrame()
    top.mainloop()
Example #13
0
def MenuUser():
    UserWindow = tk.Toplevel(window)
    UserWindow.title("Add New User") 
    UserWindow.geometry('800x500')
    
    UserList = [
    "Add User"
    ] 
    UserVariable = StringVar(UserWindow)
    UserVariable.set(UserList[0]) # default value 
    UserOptionMenu = tk.OptionMenu(UserWindow, UserVariable, *UserList)
    UserOptionMenu.pack()
        
    def AddUser():
        tkMessageBox.showinfo('WLabs Replenisher', 'Successfully Add New User')  
    
    AddUserBT = tk.Button(UserWindow, text="Add User", command=AddUser)
    AddUserBT.pack()
    
    #To use tkintertable  
    tframe = tk.Frame(UserWindow)
    tframe.pack()  
    model = TableModel()
    table = TableCanvas(tframe, model=model)
    table.createTableFrame()
    
    model = table.model
    data = {'rec1': {'ID': 'User1', 'First Name': 'Tom', 'Last Name': 'Cross' },  
            'rec2': {'ID': 'User2', 'First Name': 'Jim', 'Last Name': 'Wood' },
            'rec3': {'ID': 'User3', 'First Name': 'Bryan', 'Last Name': 'Bush' }               
           }  
    model.importDict(data) #Import from a dictionary to populate model
    table.redrawTable()

    #Add New Row button
    def AddRowButton():
        table.addRow() 
        table.redrawTable() 
    
    AddRowBTN = tk.Button(UserWindow,text='Add New Row', command = AddRowButton)
    AddRowBTN.place(relx=0.9, rely=0.15, anchor=tk.CENTER)     
    
    UserWindow.mainloop()
Example #14
0
def MenuTask():
    TaskWindow = tk.Toplevel(window)
    TaskWindow.title("Add New Tasks") 
    TaskWindow.geometry('800x500')
    
    TaskList = [
    "Add Task"
    ] 
    TaskVariable = StringVar(TaskWindow)
    TaskVariable.set(TaskList[0]) # default value 
    TaskOptionMenu = tk.OptionMenu(TaskWindow, TaskVariable, *TaskList)
    TaskOptionMenu.pack()    
    
    def AddTask():
        tkMessageBox.showinfo('WLabs Replenisher', 'Successfully Add New Task')  
    
    AddTaskBT = tk.Button(TaskWindow, text="Add Task", command=AddTask)
    AddTaskBT.pack()
    
    #To use tkintertable  
    tframe = tk.Frame(TaskWindow)
    tframe.pack()  
    model = TableModel()
    table = TableCanvas(tframe, model=model)
    table.createTableFrame()
    
    model = table.model
    data = {'rec1': {'ID': 'Task1', 'Priority': 'High' },  
            'rec2': {'ID': 'Task2', 'Priority': 'Low'  },
            'rec3': {'ID': 'Task3', 'Priority': 'Low'  }               
           }  
    model.importDict(data) #Import from a dictionary to populate model
    table.redrawTable()
    
    #Add New Row button
    def AddRowButton():
        table.addRow() 
        table.redrawTable() 
    
    AddRowBTN = tk.Button(TaskWindow,text='Add New Row', command = AddRowButton)
    AddRowBTN.place(relx=0.9, rely=0.15, anchor=tk.CENTER)      
        
    TaskWindow.mainloop()
Example #15
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')
Example #16
0
def populateData(type):
    top = Toplevel()
    analysis = {}
    if type == "LDA":
        with open("./analysis/LDA_output.txt") as f:
            next(f)
            index = 0
            for line in f:
                tokens = line.rstrip('\n').split(':')
                topicWords = tokens[1].split('+')
                print(topicWords)
                for w in topicWords:
                    record = {}
                    tw = w.split('*')
                    record["Topic ID"] = tokens[0]
                    record["Probability"] = tw[0]
                    word = tw[1].replace('"', '').replace('"', '')
                    record["Word"] = word
                    analysis[index] = record
                    index = index + 1
    else:
        with open("./analysis/LSI_output.txt") as f:
            next(f)
            index = 0
            for line in f:
                record = {}
                tokens = line.rstrip('\n').split(':')
                record["Document Name"] = tokens[0]
                record["Document ID"] = tokens[1]
                record["Probability"] = tokens[2]
                analysis[index] = record
                index = index + 1
    model = TableModel()
    model.importDict(analysis)
    table = TableCanvas(top, model=model)
    table.createTableFrame()
    top.mainloop()
Example #17
0
def submit(*value):
    print('_____________________________________________________________')

    model = TableModel()
    # load data
    data = load_data(name, value)
    # import data to tablemodel
    model.importDict(data)

    # Create table for records preview
    table = TableCanvas(recordsFrame,
                        name="tablica",
                        model=model,
                        width=420,
                        height=600,
                        cols=0,
                        rows=0,
                        cellwidth=50,
                        editable=False,
                        showkeynamesinheader=True,
                        reverseorder=0)
    table.grid(row=0, sticky=W + N + S)
    table.createTableFrame()
    table.redrawTable()
Example #18
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)
starting_vertex.grid(column=0, row=1, padx=5, pady=5,)
    def fill_table(self):
        # Update accumulated plans
        yr_current = date.today().year
        yr_accu = [0, 0]
        yr_last_1_accu = [0, 0]
        yr_last_2_accu = [0, 0]
        for uni in self.university_list:
            if yr_current in uni.plans:
                yr_accu[Class_Science_Index] += uni.plans[yr_current][
                    Class_Science_Index]
                yr_accu[Class_Art_Index] += uni.plans[yr_current][
                    Class_Art_Index]
                uni.update_accumulated_plan(yr_current,
                                            yr_accu[Class_Science_Index],
                                            yr_accu[Class_Art_Index])
            if (yr_current - 1) in uni.plans:
                yr_last_1_accu[Class_Science_Index] += uni.plans[
                    yr_current - 1][Class_Science_Index]
                yr_last_1_accu[Class_Art_Index] += uni.plans[
                    yr_current - 1][Class_Art_Index]
                uni.update_accumulated_plan(
                    yr_current - 1, yr_last_1_accu[Class_Science_Index],
                    yr_last_1_accu[Class_Art_Index])
            if (yr_current - 2) in uni.plans:
                yr_last_2_accu[Class_Science_Index] += uni.plans[
                    yr_current - 2][Class_Science_Index]
                yr_last_2_accu[Class_Art_Index] += uni.plans[
                    yr_current - 2][Class_Art_Index]
                uni.update_accumulated_plan(
                    yr_current - 2, yr_last_2_accu[Class_Science_Index],
                    yr_last_2_accu[Class_Art_Index])

        # Filter types for display
        self.candidates = []
        for uni in self.university_list:
            if ((self.type_985_value.get() and uni.type_985)
                    or (self.type_211_value.get() and uni.type_211)
                    or (self.type_lead_uni_value.get() and uni.type_lead_uni)
                    or (self.type_lead_sub_value.get() and uni.type_lead_sub)
                    or (self.type_others_value.get() and uni.type_985 == 0
                        and uni.type_211 == 0 and uni.type_lead_uni == 0
                        and uni.type_lead_sub == 0)
                    or self.type_all_value.get()):
                self.candidates.append(uni)
        print "Side of candidates: ", len(self.candidates)
        self.candidates.sort(key=lambda x: x.rank)

        print "update display based on class and types"
        data = {
            'rec1': {
                'col1': 99.88,
                'col2': 108.79,
                'label': 'rec1'
            },
            'rec2': {
                'col1': 99.88,
                'col2': 108.79,
                'label': 'rec2'
            }
        }
        model = TableModel(rows=20, columns=10)
        table = TableCanvas(self.table_list, model=model)
        table.pack(fill=Tk.BOTH, expand=True)
        table.cellbackgr = "white"
        table.selectedcolor = 'green'
        table.createTableFrame()

        model = table.model
        model.importDict(
            data)  # can import from a dictionary to populate model
        table.redrawTable()
        '''rows = len(self.candidates) + 1
Example #20
0
def run():
    global reader, time, x_angle, y_angle, day, month, year, table, model, index
    
    # tk init
    root = tk.Tk()
    root.title('Smart Egg 3D Visualisation')
    root.geometry("1100x650")    #Set the size of the app to be 800x600
    #root.resizable(0, 0)        #Don't allow resizing in the x or y direction

    # Initializa Menubar
    menubar = Menu(root)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Open file", command=openfile)
    filemenu.add_command(label="Close file", command=closefile)
    filemenu.add_separator()
    filemenu.add_command(label="Exit", command=root.quit)
    menubar.add_cascade(label="File", menu=filemenu)
    root.config(menu=menubar)

    # TODO create rest only when file selected
    
    # Create embed frame for pygame window
    embed = tk.Frame(root, width=700, height=600) 
    embed.grid(row=0,column=0)
    # Create embed frame for records preview console
    records = tk.Frame(root, width=300, height=600)
    records.grid(row=0,column=1)
    records.pack_propagate(0)
    # Create Table for records preview
    model = TableModel()
    table = TableCanvas(records,name="tablica",model=model, width=300, height=600, cols=0, rows=0,  cellwidth=50, editable=False, showkeynamesinheader=True, reverseorder=0)
    table.grid(row=0,sticky=W+N+S)
    table.createTableFrame()

    root.bind('<ButtonRelease-1>', clicked)   #Bind the click release event
    
    #data = {"age":25}#dict((k,2) for k in a)
    #data = {'rec1': {'time': '12:04:44', 'x': 99.88, 'y': 108.79, 'z': 108.79},
    #        'rec2': {'time': '12:04:45','x': 99.88, 'y': 108.79, 'z': 108.79}}
    #model = table.model
    #model.importDict(data) #can import from a dictionary to populate model
    #model.moveColumn(model.getColumnIndex('time'),0)
    #model.moveColumn(model.getColumnIndex('x'),1)
    #model.moveColumn(model.getColumnIndex('y'),2)
    #model.moveColumn(model.getColumnIndex('z'),3)
    #table.autoResizeColumns()
    #table.redrawTable()
    #button1 = Button(records,text = 'Draw',  command=donothing)
    #button1.pack(side=LEFT)

    #child_env = dict(os.environ)
    #child_env['SDL_WINDOWID'] = str(embed.winfo_id())#the_window_id
    #child_env['SDL_VIDEO_WINDOW_POS'] = '{},{}'.format(left, top)
    #p = subprocess.Popen(['lib/'],env=child_env)
    root.update()
    

    os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
   # os.environ['SDL_VIDEODRIVER'] = 'windib'
    #HWSURFACE |
    # TODO 1: load pygame and table only when file loaded
    screen = pygame.display.set_mode(SCREEN_SIZE, OPENGL | DOUBLEBUF)
    resize(*SCREEN_SIZE)
    pygame.init()
    pygame.display.init()
    #pygame.display.update()

    root.update()  

    init()
    clock = pygame.time.Clock()
    
    egg = Egg((0.7, 0.0, 0.0), (1, .95, .8))
    #cube = Cube((0.0, 0.0, 0.0), (1, .95, .8))
    
    # turn off autoplay
    play = False
    if file_pointer != -1:
        # read first element
        values = read_next_values()
        if values != None:
            time = values[0]
            x_angle = values[1]
            y_angle = values[2]
    
    while True:
        drawXYZCoordinate()

        #then = pygame.time.get_ticks()
        

        # TODO 1: Key control
        # TODO 2: Mark Temperature sensors are reference
        for event in pygame.event.get():
            if event.type == QUIT:
                return
            if event.type == KEYUP:
                if event.key == K_UP:
                    if table.getSelectedRow() > 0: 
                        table.gotoprevRow()
                    #play = True
                if event.key == K_DOWN:
                    if table.getSelectedRow() < table.model.getRowCount()-1:
                        table.gotonextRow()
                    #play = False
                if play or event.key == K_RIGHT:
                    values = get_record(index)
                    #values = read_next_values()
                    print(values)
                    if values == None:
                        print("Koniec Pliku")
                    else:
                        time = values[0]
                        x_angle = values[1]
                        y_angle = values[2]
                if event.key == K_LEFT:
                    values = get_record(index)
                    print(values)
                    #values = read_previous_values()
                    if values == None:
                        print("Poczatek pliku!")
                    else:
                        time = values[0]
                        x_angle = values[1]
                        y_angle = values[2]
                if event.key == K_ESCAPE:
                    return

        # autoplay mode
        if play:
            values = read_next_values()
            if values == None:
                print("Koniec Pliku!")
            else:
                    time = values[0]
                    x_angle = values[1]
                    y_angle = values[2]

        if file_pointer != -1:
            glPushMatrix()
            # Correct
            glRotate(float(x_angle), 0, 0, 1)
            glRotate(float(y_angle), 1, 0, 0)
            egg.render()
            glPopMatrix()

            drawText(0, 2, time)
            
        pygame.display.flip()
        root.update() 
Example #21
0
class SalariesCalculator():
    def __init__(self, Salaries):
        date_var1 = tk.StringVar()
        date_var2 = tk.StringVar()
        self.Worker = "Francisco"
        self.window = Salaries
        Date = str(date.today().strftime("%d/%m/%Y"))
        if Date[0:2] <= '15':
            D1 = "01" + Date[2:]
            D2 = "15" + Date[2:]
        else:
            D1 = "16" + Date[2:]
            D2 = Date
        X = 50
        Y = 50

        Lb = tk.Label(self.window,
                      bg='skyblue',
                      font=("Arial", 12),
                      text="De:")
        Lb.place(x=X + 80, y=Y)
        self.Date1 = tk.Entry(self.window,
                              bg='white',
                              font=("Arial", 12),
                              textvariable=date_var1)
        date_var1.set(D1)
        self.Date1.place(x=X + 80, y=Y + 30)

        Lb = tk.Label(self.window,
                      bg='skyblue',
                      font=("Arial", 12),
                      text="Hasta:")
        Lb.place(x=X + 80, y=Y + 60)
        self.Date2 = tk.Entry(self.window,
                              bg='white',
                              font=("Arial", 12),
                              textvariable=date_var2)
        date_var2.set(D2)
        self.Date2.place(x=X + 80, y=Y + 90)

        Lb = tk.Label(self.window,
                      bg='skyblue',
                      font=("Arial", 12),
                      text="Concepto:")
        Lb.place(x=X + 335, y=Y)
        self.Worker_list = tk.Listbox(self.window,
                                      bg='white',
                                      fg='black',
                                      height=3,
                                      selectmode='SINGLE',
                                      width=25,
                                      font=("Arial", 12))
        Workers = ['Francisco', 'Guadalupe', 'Diego']
        for item in Workers:
            self.Worker_list.insert(tk.END, item)
        self.Worker_list.place(x=X + 335, y=Y + 30)
        self.Worker_list.bind("<ButtonRelease-1>", self.update_table)

        ###### Tabla de Salarios ######
        Lb = tk.Label(self.window,
                      bg='skyblue',
                      font=("Arial", 12),
                      text="Salarios:")
        Lb.place(x=X + 663, y=Y)
        Fecha = self.Date1.get()
        Fecha1 = Fecha[6:10] + "-" + Fecha[3:5] + "-" + Fecha[0:2]
        Fecha = self.Date2.get()
        Fecha2 = Fecha[6:10] + "-" + Fecha[3:5] + "-" + Fecha[0:2]
        try:
            SelectQuery = "SELECT Responsable, SUM(Monto) AS Salario FROM Transactions.dbo.Transactions \
                where Concepto = 'Sueldo' and Fecha between '"                                                              + Fecha1 \
                    + "' and '" + Fecha2 + "' GROUP BY Responsable;"
            Data = pd.read_sql(SelectQuery, conn)
        except:
            df = {
                'Responsable': ['Francisco', 'Guadalupe', 'Diego'],
                'Salario': ['', '', '']
            }
            Data = pd.DataFrame(df)

        tframe_sal = tk.Frame(self.window, bg="blue", highlightcolor="blue")
        tframe_sal.place(x=X + 663, y=Y + 30, height=130, width=318)
        rec, col = Data.shape
        aux = dict()
        data = dict()
        for i in range(rec):
            for j in range(col):
                aux[Data.columns[j]] = Data.values[i, j]
            data['rec' + str(i + 1)] = aux.copy()

        self.model_sal = TableModel()
        self.table_sal = TableCanvas(tframe_sal,
                                     cellbackgr='white',
                                     thefont=(
                                         'Arial',
                                         12,
                                     ),
                                     cellwidth=140,
                                     rowheight=25,
                                     rowheaderwidth=30,
                                     rowselectedcolor='yellow',
                                     editable=False,
                                     model=self.model_sal)
        self.table_sal.createTableFrame()
        self.model_sal = self.table_sal.model
        self.model_sal.importDict(data)
        self.table_sal.show()

        ###### Tabla de Actividades ######
        try:
            SelectQuery = "SELECT #, Fecha, Concepto, Monto, Responsable, Comentario FROM Transactions.dbo.Transactions \
                where Concepto = 'Sueldo' and Responsable = '"                                                               + self.Worker + "' and Fecha between '"+ Fecha1 \
                    + "' and '" + Fecha2 + "';"
            Data = pd.read_sql(SelectQuery, conn)
        except:
            df = {
                '#': [''],
                'Fecha': [''],
                'Concepto': [''],
                'Monto': [''],
                'Responsable': [''],
                'Comentario': ['']
            }
            Data = pd.DataFrame(df)

        tframe_act = tk.Frame(self.window, bg="blue", highlightcolor="blue")
        tframe_act.place(x=X + 80, y=Y + 135, height=350, width=900)
        rec, col = Data.shape
        aux = dict()
        data = dict()
        for i in range(rec):
            for j in range(col):
                aux[Data.columns[j]] = Data.values[i, j]
            data['rec' + str(i + 1)] = aux.copy()

        self.model_act = TableModel()
        self.table_act = TableCanvas(tframe_act,
                                     cellbackgr='white',
                                     thefont=(
                                         'Arial',
                                         12,
                                     ),
                                     cellwidth=140,
                                     rowheight=25,
                                     rowheaderwidth=30,
                                     rowselectedcolor='yellow',
                                     editable=False,
                                     model=self.model_act)
        self.table_act.createTableFrame()
        self.model_act = self.table_act.model
        self.model_act.importDict(data)
        self.table_act.show()

    def update_table(self, event):
        widget = event.widget
        selection = widget.curselection()
        self.Worker = widget.get(selection[0])
        Fecha = self.Date1.get()
        Fecha1 = Fecha[6:10] + "-" + Fecha[3:5] + "-" + Fecha[0:2]
        Fecha = self.Date2.get()
        Fecha2 = Fecha[6:10] + "-" + Fecha[3:5] + "-" + Fecha[0:2]

        try:
            SelectQuery = "SELECT #, Fecha, Concepto, Monto, Responsable, Comentario FROM Transactions.dbo.Transactions \
                where Concepto = 'Sueldo' and Responsable = '"                                                               + self.Worker + "' and Fecha between '"+ Fecha1 \
                    + "' and '" + Fecha2 + "';"
            Data = pd.read_sql(SelectQuery, conn)
        except:
            df = {
                '#': [''],
                'Fecha': [''],
                'Concepto': [''],
                'Monto': [''],
                'Responsable': [''],
                'Comentario': ['']
            }
            Data = pd.DataFrame(df)
        rec, col = Data.shape
        aux = dict()
        data = dict()

        for i in range(rec):
            for j in range(col):
                aux[Data.columns[j]] = Data.values[i, j]
            data['rec' + str(i + 1)] = aux.copy()
        self.model_act.deleteRows(range(0, self.model_act.getRowCount()))
        self.model_act.importDict(data)
        self.table_act.redraw()

        try:
            SelectQuery = "SELECT Responsable, SUM(Monto) AS Salario FROM Transactions.dbo.Transactions \
                where Concepto = 'Sueldo' and Fecha between '"                                                              + Fecha1 \
                    + "' and '" + Fecha2 + "' GROUP BY Responsable;"
            Data = pd.read_sql(SelectQuery, conn)
        except:
            df = {
                'Responsable': ['Francisco', 'Guadalupe', 'Diego'],
                'Salario': ['', '', '']
            }
            Data = pd.DataFrame(df)
        rec, col = Data.shape
        aux = dict()
        data = dict()

        for i in range(rec):
            for j in range(col):
                aux[Data.columns[j]] = Data.values[i, j]
            data['rec' + str(i + 1)] = aux.copy()
        self.model_sal.deleteRows(range(0, self.model_sal.getRowCount()))
        self.model_sal.importDict(data)
        self.table_sal.redraw()
Example #22
0
def run():
    global reader, time, x_angle, y_angle, day, month, year, table, model
    
    # tk init
    root = tk.Tk()
    root.title('Smart Egg 3D Visualisation')
    root.geometry("1100x650")    #Set the size of the app to be 800x600
    #root.resizable(0, 0)        #Don't allow resizing in the x or y direction

    # Initializa Menubar
    menubar = Menu(root)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Open file", command=openfile)
    filemenu.add_command(label="Close file", command=closefile)
    #filemenu.add_separator()
    #filemenu.add_command(label="Exit", command=root.quit)
    menubar.add_cascade(label="File", menu=filemenu)
    root.config(menu=menubar)
    
    # Create embed frame for pygame window
    embed = tk.Frame(root, width=700, height=600) 
    embed.grid(row=0,column=0)
    # Create embed frame for records preview console
    records = tk.Frame(root, width=300, height=600)
    records.grid(row=0,column=1)
    records.pack_propagate(0)
    # Create Table for records preview
    model = TableModel()
    table = TableCanvas(records,name="tablica",model=model, width=300, height=600, cols=0, rows=0,  cellwidth=50, editable=False, showkeynamesinheader=True, reverseorder=0)
    table.grid(row=0,sticky=W+N+S)
    table.createTableFrame()

    root.bind('<ButtonRelease-1>', clicked)   #Bind the click release event
    
    #data = {"age":25}#dict((k,2) for k in a)
    #data = {'rec1': {'time': '12:04:44', 'x': 99.88, 'y': 108.79, 'z': 108.79},
    #        'rec2': {'time': '12:04:45','x': 99.88, 'y': 108.79, 'z': 108.79}}
    #model = table.model
    #model.importDict(data) #can import from a dictionary to populate model
    #model.moveColumn(model.getColumnIndex('time'),0)
    #model.moveColumn(model.getColumnIndex('x'),1)
    #model.moveColumn(model.getColumnIndex('y'),2)
    #model.moveColumn(model.getColumnIndex('z'),3)
    #table.autoResizeColumns()
    #table.redrawTable()
    #button1 = Button(records,text = 'Draw',  command=donothing)
    #button1.pack(side=LEFT)
    #os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
    #os.environ['SDL_VIDEODRIVER'] = 'windib'

    #os.environ["SDL_VIDEODRIVER"] = "dummy"
    
    screen = pygame.display.set_mode(SCREEN_SIZE, HWSURFACE | OPENGL | DOUBLEBUF)
    resize(*SCREEN_SIZE)
    #screen.fill(pygame.Color(255,255,255))
    pygame.init()
    pygame.display.init()
    #pygame.display.update()

    root.update()  

    init()
    clock = pygame.time.Clock()
    egg = Egg2((0.0, 0.0, 0.0), (1, .95, .8))
    #cube = Cube((0.0, 0.0, 0.0), (1, .95, .8))
    angle = 0
    
    # turn off autoplay
    play = False
    if file_pointer != -1:
        # read first element
        values = read_next_values()
        if values != None:
            time = values[0]
            x_angle = values[1]
            y_angle = values[2]
    
    while True:
        then = pygame.time.get_ticks()

        # TODO 1: Key control
        # TODO 2: Mark Temperature sensors are reference
        # TODO 3: Shading
        for event in pygame.event.get():
            if event.type == QUIT:
                return
            if event.type == KEYUP:
                if event.key == K_UP:
                    print(pygame.colored('Odtwarzanie automatyczne','green'))
                    play = True
                if event.key == K_DOWN:
                    print(pygame.colored('Pauza','red'))
                    play = False
                if play or event.key == K_RIGHT:
                    values = read_next_values()
                    if values == None:
                        print(pygame.colored('Koniec Pliku!','red'))
                    else:
                        time = values[0]
                        x_angle = values[1]
                        y_angle = values[2]
                if event.key == K_LEFT:
                    values = read_previous_values()
                    if values == None:
                        print(pygame.colored('Poczatek pliku!','green'))
                    else:
                        time = values[0]
                        x_angle = values[1]
                        y_angle = values[2]
                if event.key == K_ESCAPE:
                    return

        # autoplay mode
        if play:
            values = read_next_values()
            if values == None:
                print(pygame.colored('Koniec Pliku!','red'))
            else:
                    time = values[0]
                    x_angle = values[1]
                    y_angle = values[2]
                   

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        glColor((1.,1.,1.))
        glLineWidth(1)
        glBegin(GL_LINES)

        # uklad wspolrzedny (x, y, z)
        for x in range(-20, 22, 2):
            glVertex3f(x/10.,-1,-2)
            glVertex3f(x/10.,-1,2)
    
        '''for x in range(-20, 22, 2):
            glVertex3f(x/10.,-1, 1)
            glVertex3f(x/10., 1, 1)
        '''
        for z in range(-20, 22, 2):
            glVertex3f(-2, -1, z/10.)
            glVertex3f( 2, -1, z/10.)
        
        '''for z in range(-10, 12, 2):
            glVertex3f(-2, -1, z/10.)
            glVertex3f(-2,  1, z/10.)
        
        for z in range(-10, 12, 2):
            glVertex3f( 2, -1, z/10.)
            glVertex3f( 2,  1, z/10.)
        
        for y in range(-10, 12, 2):
            glVertex3f(-2, y/10., 1)
            glVertex3f( 2, y/10., 1)
        
        for y in range(-10, 12, 2):
            glVertex3f(-2, y/10., 1)
            glVertex3f(-2, y/10., -1)
        
        for y in range(-10, 12, 2):
            glVertex3f(2, y/10., 1)
            glVertex3f(2, y/10., -1)
        '''
        glEnd()

        # draw xyz axis
        glLineWidth(2)
        glBegin(GL_LINES)
        # draw line for x axis
        glColor3f(1.0, 0.0, 0.0)

        glVertex3f(-2.2, -1.0, -2.4);
        glVertex3f(-1.2, -1.0, -2.4);
        glVertex3f(-1.2, -1.0, -2.4);
        glVertex3f(-1.3, -0.98, -2.4);
        glVertex3f(-1.3, -0.98, -2.4);
        glVertex3f(-1.3, -1.02, -2.4);
        glVertex3f(-1.3, -1.02, -2.4);
        glVertex3f(-1.2, -1.0, -2.4);

        # draw line for y axis
        glColor3f(0.0, 1.0, 0.0)

        glVertex3f(-2.2, -1.0, -2.4);
        glVertex3f(-2.2, -0.6, -2.4);
        glVertex3f(-2.2, -0.6, -2.4);
        glVertex3f(-2.22, -0.7, -2.4);
        glVertex3f(-2.22, -0.7, -2.4);
        glVertex3f(-2.18, -0.7, -2.4);
        glVertex3f(-2.18, -0.7, -2.4);
        glVertex3f(-2.2, -0.6, -2.4);

        # draw line for z axis
        glColor3f(0.0, 0.0, 1.0)

        glVertex3f(-2.2, -1.0, -2.4);
        glVertex3f(-2.2, -1.0, -2.0);
        glVertex3f(-2.2, -1.0, -2.0);
        glVertex3f(-2.18, -1.0, -2.1);
        glVertex3f(-2.18, -1.0, -2.1);
        glVertex3f(-2.22, -1.0, -2.1);
        glVertex3f(-2.22, -1.0, -2.1);
        glVertex3f(-2.2, -1.0, -2.0);
        
        glEnd()
        
        if file_pointer != -1:
            glPushMatrix()
            # Correct
            glRotate(float(x_angle), 0, 0, 1)
            glRotate(float(y_angle), 1, 0, 0)
            #glRotate(float(x_angle), 1, 0, 0)
            #glRotate(-float(y_angle), 0, 0, 1)
            #cube.render()
            egg.render()
            glPopMatrix()

            drawText(0, 2, time)
            
        pygame.display.flip()
        root.update() 
Example #23
0
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()
Example #24
0
def demo1(root):
    frame = Frame(root)
    frame.pack()
    table = TableCanvas(frame)
    table.createTableFrame()
Example #25
0
def openfile():
    global table, time, x_angle, y_angle, day, month, year, root, embedFrame, recordsFrame, play

    name = tkFileDialog.askopenfilename(initialdir=".",
                                        title="Select file",
                                        filetypes=(("Text File", "*.txt"),
                                                   ("All Files", "*.*")))

    if name == "":
        # if file openning was cancelled then return
        return
    else:
        try:
            path = name.split('/')
            # get date from file name
            filename = path[len(path) - 1]
            day = filename[6:8]
            month = filename[4:6]
            year = filename[2:4]

            # create data
            model = TableModel()
            # load data
            data = load_data(name)
            # import data ti tablemodel
            model.importDict(data)
        except:
            tkMessageBox.showerror("Error", "File reading failed!")
            return

    # If another file is open already then close it
    if table != None:
        closefile()

    # Change App title to include currently open file
    root.title('Smart Egg 3D Visualisation ver.1.1 - ' + filename)

    # Create embed frame for pygame window
    embedFrame = tk.Frame(root, width=700, height=600)
    embedFrame.grid(row=0, column=0)
    # Create embed frame for table
    recordsFrame = tk.Frame(root, width=450, height=600)
    recordsFrame.grid(row=0, column=1)
    recordsFrame.pack_propagate(0)
    # Create table for records preview
    table = TableCanvas(recordsFrame,
                        name="tablica",
                        model=model,
                        width=420,
                        height=600,
                        cols=0,
                        rows=0,
                        cellwidth=50,
                        editable=False,
                        showkeynamesinheader=True,
                        reverseorder=0)
    table.grid(row=0, sticky=W + N + S)
    table.createTableFrame()
    # arrange columns width and order
    model.moveColumn(model.getColumnIndex('time'), 1)
    model.moveColumn(model.getColumnIndex('x'), 2)
    model.moveColumn(model.getColumnIndex('y'), 3)
    model.moveColumn(model.getColumnIndex('z'), 4)
    model.moveColumn(model.getColumnIndex('roll'), 5)
    model.moveColumn(model.getColumnIndex('pitch'), 6)
    model.columnwidths['time'] = 150

    table.redrawTable()

    # Initiate and embed pygame
    os.environ['SDL_WINDOWID'] = str(embedFrame.winfo_id())
    #os.environ['SDL_VIDEODRIVER'] = 'windib'
    screen = pygame.display.set_mode(SCREEN_SIZE,
                                     HWSURFACE | OPENGL | DOUBLEBUF)
    resize(*SCREEN_SIZE)
    pygame.init()
    pygame.display.init()

    #Bind keys and buttons events
    root.bind('<ButtonRelease-1>', handle_click)  #click release event
    root.bind_all("<Up>", handle_arrow_keys)  #press Up key event
    root.bind_all("<Down>", handle_arrow_keys)  #press Down key event
    root.bind_all("<Left>", handle_arrow_keys)  #press Left key event
    root.bind_all("<Right>", handle_arrow_keys)  #press Right key event

    # Initiate OpenGL
    init_opengl()

    # Create OpenGL object
    egg = Egg((0.7, 0.0, 0.0), (1, .95, .8))

    # Load first element
    values = get_record(0)
    if values != None:
        time = values[0] + ' ' + values[1]
        x_angle = values[2]
        y_angle = values[3]

    root.update()

    # loop control variable
    play = True

    while play:
        drawXYZCoordinate()
        # Draw XYZ axis labels
        drawText3D(-1.2, -1.0, -2.4, 'x')
        drawText3D(-2.2, -0.6, -2.4, 'y')
        drawText3D(-2.2, -1.0, -2.0, 'z')

        for event in pygame.event.get():
            if event.type == KEYUP:
                handle_arrow_keys(event.key)

        glPushMatrix()
        # rotate object
        glRotate(float(x_angle), 0, 0, 1)
        glRotate(float(y_angle), 1, 0, 0)
        # render object and text
        egg.render(pygame)
        glPopMatrix()
        drawText(0, 2, time)
        # refresh screen
        pygame.display.flip()
        root.update()
Example #26
0
view_button = Button(
    root,
    text='View',
    width=10,
    command=lambda: viewEntry(map(int, listbox.curselection())))
view_button.grid(row=14, column=9, padx=5, pady=2, sticky=E)

delete_button = Button(root, text='Delete', width=10, command=deleteEntry)
delete_button.grid(row=14, column=10, padx=5, pady=2, sticky=W)

search_button = Button(root, text='Search', width=10, command=search)
search_button.grid(row=13, column=10, padx=5, pady=2, sticky=W)

edit_button = Button(root, text='Edit', width=10, command=search)
edit_button.grid(row=13, column=9, padx=5, pady=2, sticky=E)

root.grid_columnconfigure(9, minsize=10)
root.grid_rowconfigure(5, minsize=5)

root.grid_columnconfigure(7, minsize=100)
#root.grid_rowconfigure(4, minsize=100)

displayFrame = Frame(root)

tframe = Frame(root, width=20, height=5)
tframe.grid(row=3, column=7, columnspan=4)
table = TableCanvas(tframe, rows=4, cols=4, sticky=W)
table.createTableFrame()

root.mainloop()
Example #27
0
class Toplevel1:

    #Ab hier fängt die eigentliche GUI Logik an!

    nodeURL = 'https://wasp.servebeer.com:14267'  #'https://nodes.thetangle.org:443'
    targetAddress = ''
    fleetAddress = ''
    entered = False
    enteredEnemy = False
    targetRow = ''
    targetCol = ''
    shipCount = 5
    initialTime = ''
    incomingTime = []
    session = 1
    hitResponse = ''
    hitRow = ''
    hitCol = ''

    #Enter und Exit checken, ob die Maus im Enemy Fleet Frame ist. Ansonsten wird auch der Mouseclick im OurFleet Frame übernommen.

    def timer(self):
        now = datetime.datetime.now()
        dt_string = now.strftime("%d-%m-%Y,%H:%M:%S")
        return dt_string

    def enterOwn(self, event):
        self.entered = True

    def exitOwn(self, event):
        self.entered = False

    def enterEnemy(self, event):
        self.enteredEnemy = True

    def exitEnemy(self, event):
        self.enteredEnemy = False

    def updateLog(self, logEntry):
        self.Log.configure(state='normal')
        self.Log.insert(tk.INSERT, logEntry)
        self.Log.configure(state='disabled')
        self.Log.see("end")

    def checkStatus(self):
        today = datetime.datetime.now()
        todayCheck = today.strftime("%d-%m-%Y")
        initialTime = self.initialTime
        logEntry = 'Checking for incoming missiles...\n'
        self.updateLog(logEntry)
        txCommand = {
            "command": "findTransactions",
            "addresses": [self.fleetAddress]
        }
        findTx = json.dumps(txCommand)
        headers = {
            'content-type': 'application/json',
            'X-IOTA-API-Version': '1'
        }
        try:
            requestFindTx = requests.post(url=self.nodeURL,
                                          data=findTx,
                                          headers=headers)
            jsonDataTx = json.loads(requestFindTx.text)
            tryteCommand = {
                "command": "getTrytes",
                "hashes": jsonDataTx['hashes']
            }
        except:
            messagebox.showinfo("Error", "The address is invalid!")
        findTrytes = json.dumps(tryteCommand)
        requestTrytes = requests.post(url=self.nodeURL,
                                      data=findTrytes,
                                      headers=headers)
        jsonDataTrytes = json.loads(requestTrytes.content)
        for item in jsonDataTrytes['trytes']:
            tryteString = TryteString(item).decode(errors='ignore',
                                                   strip_padding=False)
            head = tryteString.split(';')
            content = head[0].split(',')
            for data in content:
                if data == todayCheck:
                    if datetime.datetime.strptime(
                            content[3],
                            '%H:%M:%S') >= datetime.datetime.strptime(
                                initialTime, '%H:%M:%S'):
                        self.incomingTime.append(content[3])
                        if len(self.incomingTime) > 1:
                            if len(set(self.incomingTime)) == self.session:
                                if datetime.datetime.strptime(
                                        content[3], '%H:%M:%S'
                                ) == datetime.datetime.strptime(
                                        max(set(self.incomingTime)),
                                        '%H:%M:%S'):
                                    self.session += 1
                                    self.displayIncoming(
                                        content[0], content[1])
                                    self.displayHitResponse(
                                        content[4], content[5], content[6])
                                    break
                        else:
                            self.session += 1
                            self.displayIncoming(content[0], content[1])

    def displayIncoming(self, row, col):
        if self.fleetDict[row][col] == 'S':
            mark = 'X'
            logEntry = 'An enemy projectile has struck your ship at ' + row + col + '!\n'
            self.updateLog(logEntry)
            self.setOwnFleetDict(row, col, mark)
            self.setHitDict(row, col, mark)
        else:
            mark = 'o'
            logEntry = 'An enemy projectile has dropped into the ocean at ' + row + col + '.\n'
            self.updateLog(logEntry)
            self.setOwnFleetDict(row, col, mark)
            self.setHitDict(row, col, mark)

    def displayHitResponse(self, row, col, mark):
        print(row + col + mark)
        if mark == 'X':
            logEntry = 'Your projectile fired at ' + row + col + ' has hit an enemy ship! \n'
            self.updateLog(logEntry)
            self.setEnemyFleetDict(row, col, mark)
        elif mark == 'o':
            logEntry = 'Your projectile has dropped into the ocean at ' + row + col + '.\n'
            self.updateLog(logEntry)
            self.setEnemyFleetDict(row, col, mark)
        else:
            return

    def saveConnectionSettings(self):
        if len(self.targetAddressEntry.get()) > 0:
            self.targetAddress = self.targetAddressEntry.get()
        if len(self.addressEntry.get()) > 0:
            self.fleetAddress = self.addressEntry.get()
        if len(self.nodeURLEntry.get()) > 0:
            self.nodeURL = self.nodeURLEntry.get()

    def click(self, event):
        try:
            row = str(int(self.table.get_row_clicked(event) + 1))
            colNum = int(self.table.get_col_clicked(event))
            col = ''
            if colNum == 0:
                col = 'A'
            elif colNum == 1:
                col = 'B'
            elif colNum == 2:
                col = 'C'
            elif colNum == 3:
                col = 'D'
            elif colNum == 4:
                col = 'E'
            if self.entered:
                self.fleetClick(row, col)
            elif self.enteredEnemy:
                self.lockTarget(row, col)
        except:
            print("Click not in main window")

    def fleetClick(self, row, col):
        while self.shipCount > 0:
            self.shipCount -= 1
            mark = 'S'
            logEntry = 'You have placed a ship at ' + row + col + '. ' + str(
                self.shipCount) + ' ships remain.\n'
            self.updateLog(logEntry)
            self.setOwnFleetDict(row, col, mark)
            return
        else:
            logEntry = 'You have no ships left to place.\n'
            self.updateLog(logEntry)
            return

    def setOwnFleetDict(self, row, col, mark):
        self.fleetDict[row][col] = mark
        self.iniFleet()

    def setEnemyFleetDict(self, row, col, mark):
        self.enemyFleetDict[row][col] = mark
        self.iniEnemyFleet()

    def setHitDict(self, row, col, mark):
        self.hitDict[row][col] = 'O'
        self.hitRow = row
        self.hitCol = col
        self.hitResponse = mark

    def lockTarget(self, row, col):
        self.ACoordinates.configure(state='normal')
        self.ACoordinates.delete("0", "end")
        self.ACoordinates.insert(tk.INSERT, row)
        self.NCoordinates.configure(state='normal')
        self.NCoordinates.delete("0", "end")
        self.NCoordinates.insert(tk.INSERT, col)
        self.targetRow = row
        self.targetCol = col

    def fire(self):
        row = self.targetRow
        col = str(self.targetCol)
        self.prepareShot(row, col)

    def prepareShot(self, row, col):
        try:
            #seed =  self.seed
            targetAddress = self.targetAddress
            api = Iota(self.nodeURL)
            closing = ';'
            fireTime = self.timer()
            hitRow = self.hitRow
            hitCol = self.hitCol
            hitResponse = self.hitResponse
            content = str(row + "," + col + "," + fireTime + "," + hitRow +
                          "," + hitCol + "," + hitResponse + closing)
            print(content)
            self.sendTransaction(targetAddress, content, api, row, col)
        except Exception as e:
            print("Error preparing TX")
            logEntry = str(e) + ' Transaction could not be created.\n'
            self.updateLog(logEntry)

    def sendTransaction(self, targetAddress, content, api, row, col):
        try:
            transaction = ProposedTransaction(
                address=Address(targetAddress),
                message=TryteString.from_unicode(content),
                tag=Tag(b'NODE9TEST'),
                value=0,
            )
            api.send_transfer([transaction])
            self.shotFired(row, col)
        except Exception as e:
            print("Error sending TX")
            print(e)
            logEntry = str(e) + ' Transaction could not be created.\n'
            self.updateLog(logEntry)

    def shotFired(self, row, col):
        mark = 'O'
        logEntry = 'You fired at ' + row + col + '!\n'
        self.updateLog(logEntry)
        self.setEnemyFleetDict(row, col, mark)

    tkFont = ["Arial", 18]
    fleetDict = {
        '1': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '2': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '3': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '4': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '5': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        }
    }

    enemyFleetDict = {
        '1': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '2': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '3': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '4': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '5': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        }
    }

    hitDict = {
        '1': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '2': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '3': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '4': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        },
        '5': {
            'A': '',
            'B': '',
            'C': '',
            'D': '',
            'E': '',
        }
    }

    def iniFleet(self):
        self.model = TableModel()
        self.table = TableCanvas(self.Fleet,
                                 model=self.model,
                                 cellwidth=105,
                                 cellbackgr='white',
                                 thefont=self.tkFont,
                                 rowheight=105,
                                 editable=True,
                                 rowselectedcolor="white",
                                 reverseorder=1,
                                 align='center')
        self.model.importDict(self.fleetDict)
        self.table.createTableFrame()
        self.table.autoResizeColumns()
        self.table.redrawTable

    def iniEnemyFleet(self):
        self.model = TableModel()
        self.table = TableCanvas(self.EnemyFleet,
                                 model=self.model,
                                 cellwidth=106,
                                 cellbackgr='white',
                                 thefont=self.tkFont,
                                 rowheight=106,
                                 editable=True,
                                 rowselectedcolor="white",
                                 reverseorder=1,
                                 align='center')
        self.model.importDict(self.enemyFleetDict)
        self.table.createTableFrame()
        self.table.autoResizeColumns()
        self.table.redrawTable

    def drawFleetTable(self):
        self.model = TableModel()
        self.table = TableCanvas(self.Fleet,
                                 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.iniFleet()

    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()

    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9'  # X11 color: 'gray85'
        _ana1color = '#d9d9d9'  # X11 color: 'gray85'
        _ana2color = '#ececec'  # Closest X11 color: 'gray92'
        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.', background=_bgcolor)
        self.style.configure('.', foreground=_fgcolor)
        self.style.configure('.', font="TkDefaultFont")
        self.style.map('.',
                       background=[('selected', _compcolor),
                                   ('active', _ana2color)])

        top.geometry("1342x872+287+110")
        top.minsize(120, 1)
        top.maxsize(5764, 1061)
        top.resizable(1, 1)
        top.title("BattleShip v0.9")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#404040")
        top.configure(highlightcolor="black")
        top.bind('<ButtonRelease-1>', self.click)

        self.style.configure('TNotebook.Tab', background=_bgcolor)
        self.style.configure('TNotebook.Tab', foreground=_fgcolor)
        self.style.map('TNotebook.Tab',
                       background=[('selected', _compcolor),
                                   ('active', _ana2color)])
        self.TNotebook1 = ttk.Notebook(top)
        self.TNotebook1.place(relx=-0.001,
                              rely=0.0,
                              relheight=0.982,
                              relwidth=0.995)
        self.TNotebook1.configure(takefocus="")
        self.TNotebook1_t1 = tk.Frame(self.TNotebook1)
        self.TNotebook1.add(self.TNotebook1_t1, padding=3)
        self.TNotebook1.tab(
            0,
            text="Bridge",
            compound="left",
            underline="-1",
        )
        self.TNotebook1_t1.configure(background="#d9d9d9")
        self.TNotebook1_t1.configure(highlightbackground="#150f4a")
        self.TNotebook1_t1.configure(highlightcolor="black")
        self.TNotebook1_t2 = tk.Frame(self.TNotebook1)
        self.TNotebook1.add(self.TNotebook1_t2, padding=3)
        self.TNotebook1.tab(
            1,
            text="Options",
            compound="left",
            underline="-1",
        )
        self.TNotebook1_t2.configure(background="#d9d9d9")
        self.TNotebook1_t2.configure(highlightbackground="#d9d9d9")
        self.TNotebook1_t2.configure(highlightcolor="black")

        self.Fleet = tk.LabelFrame(self.TNotebook1_t1)
        self.Fleet.place(relx=0.038,
                         rely=0.012,
                         relheight=0.723,
                         relwidth=0.451)
        self.Fleet.configure(relief='groove')
        self.Fleet.configure(foreground="black")
        self.Fleet.configure(text='''Our Fleet''')
        self.Fleet.configure(background="#d9d9d9")
        self.Fleet.configure(highlightbackground="#d9d9d9")
        self.Fleet.configure(highlightcolor="black")
        self.Fleet.bind('<Enter>', self.enterOwn)
        self.Fleet.bind('<Leave>', self.exitOwn)
        self.drawFleetTable()

        self.EnemyFleet = tk.LabelFrame(self.TNotebook1_t1)
        self.EnemyFleet.place(relx=0.518,
                              rely=0.012,
                              relheight=0.723,
                              relwidth=0.452)
        self.EnemyFleet.configure(relief='groove')
        self.EnemyFleet.configure(foreground="black")
        self.EnemyFleet.configure(text='''Enemy Fleet''')
        self.EnemyFleet.configure(background="#d9d9d9")
        self.EnemyFleet.configure(highlightbackground="#d9d9d9")
        self.EnemyFleet.configure(highlightcolor="black")
        self.EnemyFleet.bind('<Enter>', self.enterEnemy)
        self.EnemyFleet.bind('<Leave>', self.exitEnemy)
        self.drawEnemyFleetTable()

        self.Labelframe3 = tk.LabelFrame(self.TNotebook1_t1)
        self.Labelframe3.place(relx=0.038,
                               rely=0.747,
                               relheight=0.235,
                               relwidth=0.451)
        self.Labelframe3.configure(relief='groove')
        self.Labelframe3.configure(foreground="black")
        self.Labelframe3.configure(text='''Log''')
        self.Labelframe3.configure(background="#d9d9d9")
        self.Labelframe3.configure(highlightbackground="#d9d9d9")
        self.Labelframe3.configure(highlightcolor="black")

        self.Log = ScrolledText(self.Labelframe3)
        self.Log.place(relx=0.017,
                       rely=0.103,
                       relheight=0.846,
                       relwidth=0.975,
                       bordermode='ignore')
        self.Log.configure(background="white")
        self.Log.configure(state="disabled")
        self.Log.configure(font="TkTextFont")
        self.Log.configure(foreground="black")
        self.Log.configure(highlightbackground="#d9d9d9")
        self.Log.configure(highlightcolor="black")
        self.Log.configure(insertbackground="black")
        self.Log.configure(insertborderwidth="3")
        self.Log.configure(selectbackground="#c4c4c4")
        self.Log.configure(selectforeground="black")
        self.Log.configure(wrap="none")

        self.Labelframe4 = tk.LabelFrame(self.TNotebook1_t1)
        self.Labelframe4.place(relx=0.518,
                               rely=0.747,
                               relheight=0.235,
                               relwidth=0.452)
        self.Labelframe4.configure(relief='groove')
        self.Labelframe4.configure(foreground="black")
        self.Labelframe4.configure(text='''Command''')
        self.Labelframe4.configure(background="#d9d9d9")
        self.Labelframe4.configure(highlightbackground="#d9d9d9")
        self.Labelframe4.configure(highlightcolor="black")

        self.ACoordinates = tk.Entry(self.Labelframe4)
        self.ACoordinates.place(relx=0.116,
                                rely=0.41,
                                height=50,
                                relwidth=0.09,
                                bordermode='ignore')
        self.ACoordinates.configure(background="white")
        self.ACoordinates.configure(disabledforeground="#a3a3a3")
        self.ACoordinates.configure(font="-family {Arial} -size 16")
        self.ACoordinates.configure(foreground="#000000")
        self.ACoordinates.configure(highlightbackground="#d9d9d9")
        self.ACoordinates.configure(highlightcolor="black")
        self.ACoordinates.configure(insertbackground="black")
        self.ACoordinates.configure(justify='center')
        self.ACoordinates.configure(selectbackground="#c4c4c4")
        self.ACoordinates.configure(selectforeground="black")

        self.NCoordinates = tk.Entry(self.Labelframe4)
        self.NCoordinates.place(relx=0.266,
                                rely=0.41,
                                height=50,
                                relwidth=0.09,
                                bordermode='ignore')
        self.NCoordinates.configure(background="white")
        self.NCoordinates.configure(disabledforeground="#a3a3a3")
        self.NCoordinates.configure(font="-family {Arial} -size 16")
        self.NCoordinates.configure(foreground="#000000")
        self.NCoordinates.configure(highlightbackground="#d9d9d9")
        self.NCoordinates.configure(highlightcolor="black")
        self.NCoordinates.configure(insertbackground="black")
        self.NCoordinates.configure(justify='center')
        self.NCoordinates.configure(selectbackground="#c4c4c4")
        self.NCoordinates.configure(selectforeground="black")

        self.Fire = tk.Button(self.Labelframe4, command=self.fire)
        self.Fire.place(relx=0.698,
                        rely=0.256,
                        height=94,
                        width=157,
                        bordermode='ignore')
        self.Fire.configure(activebackground="#ececec")
        self.Fire.configure(activeforeground="#000000")
        self.Fire.configure(background="#d9d9d9")
        self.Fire.configure(disabledforeground="#a3a3a3")
        self.Fire.configure(font="-family {Arial} -size 21")
        self.Fire.configure(foreground="#000000")
        self.Fire.configure(highlightbackground="#d9d9d9")
        self.Fire.configure(highlightcolor="black")
        self.Fire.configure(pady="0")
        self.Fire.configure(text='''Fire!''')

        self.Coordinates = tk.Label(self.Labelframe4)
        self.Coordinates.place(relx=0.116,
                               rely=0.256,
                               height=21,
                               width=143,
                               bordermode='ignore')
        self.Coordinates.configure(activebackground="#f9f9f9")
        self.Coordinates.configure(activeforeground="black")
        self.Coordinates.configure(background="#d9d9d9")
        self.Coordinates.configure(disabledforeground="#a3a3a3")
        self.Coordinates.configure(foreground="#000000")
        self.Coordinates.configure(highlightbackground="#d9d9d9")
        self.Coordinates.configure(highlightcolor="black")
        self.Coordinates.configure(text='''Target Coordinates''')

        self.Check = tk.Button(self.Labelframe4, command=self.checkStatus)
        self.Check.place(relx=0.432,
                         rely=0.256,
                         height=94,
                         width=147,
                         bordermode='ignore')
        self.Check.configure(activebackground="#ececec")
        self.Check.configure(activeforeground="#000000")
        self.Check.configure(background="#d9d9d9")
        self.Check.configure(disabledforeground="#a3a3a3")
        self.Check.configure(foreground="#000000")
        self.Check.configure(highlightbackground="#d9d9d9")
        self.Check.configure(highlightcolor="black")
        self.Check.configure(pady="0")
        self.Check.configure(text='''Check''')

        self.seedEntry = tk.Entry(self.TNotebook1_t2)
        self.seedEntry.place(relx=0.09, rely=0.145, height=30, relwidth=0.424)
        self.seedEntry.configure(background="white")
        self.seedEntry.configure(disabledforeground="#a3a3a3")
        self.seedEntry.configure(font="TkFixedFont")
        self.seedEntry.configure(foreground="#000000")
        self.seedEntry.configure(highlightbackground="#d9d9d9")
        self.seedEntry.configure(highlightcolor="black")
        self.seedEntry.configure(insertbackground="black")
        self.seedEntry.configure(selectbackground="#c4c4c4")
        self.seedEntry.configure(selectforeground="black")

        self.Seed = tk.Label(self.TNotebook1_t2)
        self.Seed.place(relx=0.09, rely=0.108, height=20, width=31)
        self.Seed.configure(activebackground="#f9f9f9")
        self.Seed.configure(activeforeground="black")
        self.Seed.configure(background="#d9d9d9")
        self.Seed.configure(disabledforeground="#a3a3a3")
        self.Seed.configure(foreground="#000000")
        self.Seed.configure(highlightbackground="#d9d9d9")
        self.Seed.configure(highlightcolor="black")
        self.Seed.configure(text='''Seed''')

        self.targetAddressEntry = tk.Entry(self.TNotebook1_t2)
        self.targetAddressEntry.place(relx=0.09,
                                      rely=0.253,
                                      height=30,
                                      relwidth=0.424)
        self.targetAddressEntry.configure(background="white")
        self.targetAddressEntry.configure(disabledforeground="#a3a3a3")
        self.targetAddressEntry.configure(font="TkFixedFont")
        self.targetAddressEntry.configure(foreground="#000000")
        self.targetAddressEntry.configure(highlightbackground="#d9d9d9")
        self.targetAddressEntry.configure(highlightcolor="black")
        self.targetAddressEntry.configure(insertbackground="black")
        self.targetAddressEntry.configure(selectbackground="#c4c4c4")
        self.targetAddressEntry.configure(selectforeground="black")

        self.TargetAddress = tk.Label(self.TNotebook1_t2)
        self.TargetAddress.place(relx=0.09, rely=0.217, height=21, width=88)
        self.TargetAddress.configure(activebackground="#f9f9f9")
        self.TargetAddress.configure(activeforeground="black")
        self.TargetAddress.configure(background="#d9d9d9")
        self.TargetAddress.configure(disabledforeground="#a3a3a3")
        self.TargetAddress.configure(foreground="#000000")
        self.TargetAddress.configure(highlightbackground="#d9d9d9")
        self.TargetAddress.configure(highlightcolor="black")
        self.TargetAddress.configure(text='''Target Address''')

        self.nodeURLEntry = tk.Entry(self.TNotebook1_t2)
        self.nodeURLEntry.place(relx=0.09,
                                rely=0.47,
                                height=30,
                                relwidth=0.183)
        self.nodeURLEntry.configure(background="white")
        self.nodeURLEntry.configure(disabledforeground="#a3a3a3")
        self.nodeURLEntry.configure(font="TkFixedFont")
        self.nodeURLEntry.configure(foreground="#000000")
        self.nodeURLEntry.configure(highlightbackground="#d9d9d9")
        self.nodeURLEntry.configure(highlightcolor="black")
        self.nodeURLEntry.configure(insertbackground="black")
        self.nodeURLEntry.configure(selectbackground="#c4c4c4")
        self.nodeURLEntry.configure(selectforeground="black")

        self.NodeURL = tk.Label(self.TNotebook1_t2)
        self.NodeURL.place(relx=0.09, rely=0.434, height=20, width=58)
        self.NodeURL.configure(activebackground="#f9f9f9")
        self.NodeURL.configure(activeforeground="black")
        self.NodeURL.configure(background="#d9d9d9")
        self.NodeURL.configure(disabledforeground="#a3a3a3")
        self.NodeURL.configure(foreground="#000000")
        self.NodeURL.configure(highlightbackground="#d9d9d9")
        self.NodeURL.configure(highlightcolor="black")
        self.NodeURL.configure(text='''Node URL''')

        self.Connect = tk.Button(self.TNotebook1_t2)
        self.Connect.place(relx=0.293, rely=0.47, height=34, width=87)
        self.Connect.configure(activebackground="#ececec")
        self.Connect.configure(activeforeground="#000000")
        self.Connect.configure(background="#d9d9d9")
        self.Connect.configure(cursor="fleur")
        self.Connect.configure(disabledforeground="#a3a3a3")
        self.Connect.configure(foreground="#000000")
        self.Connect.configure(highlightbackground="#d9d9d9")
        self.Connect.configure(highlightcolor="black")
        self.Connect.configure(pady="0")
        self.Connect.configure(text='''Connect''')

        self.netEntry = tk.Entry(self.TNotebook1_t2)
        self.netEntry.place(relx=0.09, rely=0.554, height=70, relwidth=0.266)
        self.netEntry.configure(background="white")
        self.netEntry.configure(disabledforeground="#a3a3a3")
        self.netEntry.configure(font="TkFixedFont")
        self.netEntry.configure(foreground="#000000")
        self.netEntry.configure(highlightbackground="#d9d9d9")
        self.netEntry.configure(highlightcolor="black")
        self.netEntry.configure(insertbackground="black")
        self.netEntry.configure(selectbackground="#c4c4c4")
        self.netEntry.configure(selectforeground="black")

        self.NetStatus = tk.Label(self.TNotebook1_t2)
        self.NetStatus.place(relx=0.09, rely=0.518, height=21, width=86)
        self.NetStatus.configure(activebackground="#f9f9f9")
        self.NetStatus.configure(activeforeground="black")
        self.NetStatus.configure(background="#d9d9d9")
        self.NetStatus.configure(disabledforeground="#a3a3a3")
        self.NetStatus.configure(foreground="#000000")
        self.NetStatus.configure(highlightbackground="#d9d9d9")
        self.NetStatus.configure(highlightcolor="black")
        self.NetStatus.configure(text='''Network Status''')

        self.addressEntry = tk.Entry(self.TNotebook1_t2)
        self.addressEntry.place(relx=0.09,
                                rely=0.361,
                                height=30,
                                relwidth=0.424)
        self.addressEntry.configure(background="white")
        self.addressEntry.configure(disabledforeground="#a3a3a3")
        self.addressEntry.configure(font="TkFixedFont")
        self.addressEntry.configure(foreground="#000000")
        self.addressEntry.configure(insertbackground="black")

        self.Address = tk.Label(self.TNotebook1_t2)
        self.Address.place(relx=0.09, rely=0.325, height=20, width=54)
        self.Address.configure(background="#d9d9d9")
        self.Address.configure(disabledforeground="#a3a3a3")
        self.Address.configure(foreground="#000000")
        self.Address.configure(text='''Address''')

        self.Save = tk.Button(self.TNotebook1_t2,
                              command=self.saveConnectionSettings)
        self.Save.place(relx=0.563, rely=0.241, height=54, width=117)
        self.Save.configure(activebackground="#ececec")
        self.Save.configure(activeforeground="#000000")
        self.Save.configure(background="#d9d9d9")
        self.Save.configure(disabledforeground="#a3a3a3")
        self.Save.configure(foreground="#000000")
        self.Save.configure(highlightbackground="#d9d9d9")
        self.Save.configure(highlightcolor="black")
        self.Save.configure(pady="0")
        self.Save.configure(text='''Save''')