def print_unusual_amino_acid(self):

        '''Check if ico file exist'''
        if self.check_if_ico_exist() == False:
            return f'"logo.ico" file doesnt exist. File has to be added to the directory;{self.ico_path()}'

        '''check if unusual_amino.csv" exist'''
        if self.check_if_data_exist() == False:
            return f'"unusual_amino.csv" doesnt exist. Amino acid has to be added first;{self.data_path()}'

        '''check if unusual_amino.csv is empty - first checked if exist'''
        if self.check_if_unusual_amino_is_empty() == 'True':
            return f'Please note that file "unusual_amino.csv" is empty; Or it contains only one row'
        else:
            '''Sets icon'''
            root = tk.Tk()
            root.title('PeptideMassCalculator')
            root.iconbitmap(self.ico_path())

            frame = tk.Frame(root)
            frame.pack(fill='both', expand=True)
            datatable = Table(frame, showtoolbar=False, showstatusbar=True)
            datatable.show()

            '''shows unusual_amino.csv in the table'''
            datatable.importCSV(filename=self.data_path(), dialog=False)
            root.mainloop()
Ejemplo n.º 2
0
def retrievePassword(root, userSecret):
    root.destroy()

    hoje = Tk()
    hoje.geometry("480x300")
    hoje.title('SmartLocker')

    FILENAME = Image.open('photo.png')
    tk_img = ImageTk.PhotoImage(FILENAME)

    frame1 = tk.Frame(hoje, bg='black')
    frame1.place(relwidth=1.0, relheight=1.0)

    frame1.place(relwidth=1.0, relheight=1.0)
    labetse2 = Label(frame1, image=tk_img)
    labetse2.pack()
    labetset = Label(frame1, image=tk_img)
    #labetset.grid(row=0, column=0)
    labetset.pack()
    labetset.place(relwidth=1.0, relheight=0.6)

    frameText = Label(labetset,
                      text="Take a look on what info we have!",
                      bg='black',
                      fg='white',
                      font=('Courier', 17))
    #frameText.grid(row=2, columnspan=3)
    frameText.place(x=15, y=280)

    #userSecret.showServices()

    toolbar = tk.Frame(labetset)

    pt = Table(labetset, width=480, height=150)

    button = tk.Button(frame1,
                       text="Quit",
                       font='Courier',
                       fg='red',
                       background='blue',
                       highlightbackground='green',
                       command=quit)
    button.place(x=220, y=250)
    buttonSwitch = tk.Button(frame1,
                             text="Add New Account",
                             font='Courier',
                             fg='red',
                             background='blue',
                             highlightbackground='green',
                             command=lambda: frameAddPassword(hoje))
    buttonSwitch.place(x=280, y=250)

    pt.importCSV(filename='password.csv')
    pt.show()

    pt.setColumnColors(cols=2, clr='red')

    #button.place(x=100, y =100)

    hoje.mainloop()
Ejemplo n.º 3
0
 def getCSV(self):
     root = tk.Tk()
     root.title('PandasTable')
     frame = tk.Frame(root)
     frame.pack(fill='both', expand=True)
     pt = Table(frame)
     pt.show()
     import_file_path = filedialog.askopenfilename()
     pt.importCSV(filename=import_file_path, dialog=True)
     root.mainloop()
def load_dataset():
    dataset_window = Tk()
    dataset_window.geometry('1000x800')
    dataset_window.title('Dataset')
    f = Frame(dataset_window)
    tb = Table(f)
    f.pack(fill=BOTH, expand=True)
    tb.importCSV('train.csv')
    tb.show()
    dataset_window.mainloop()
def Employee():
    filename = "EmployeeDetails\EmployeeDetails.csv"
    root3 = Tk()
    root3.title("Employee Table")
    frame = Frame(root3)
    frame.pack()
    pt = Table(frame)
    pt.importCSV(filename)
    pt.show()
    root3.mainloop()
Ejemplo n.º 6
0
def open_file():
    file = filedialog.askopenfilename(
        initialdir="/home/pi/Desktop/AutomatedCableTester",
        title="Select file",
        filetypes=(("csv files", "*.csv"), ("all files", "*.*")))
    if len(file) != 0 and ".csv" in file:
        t = tk.Toplevel()
        pt = Table(t)
        pt.importCSV(file)
        pt.redraw()
        pt.show()
Ejemplo n.º 7
0
def attendance():
    ts = time.time()
    date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
    filename = "Attendance\Attendance_" + date + ".csv"
    root2 = Tk()
    root2.title("Attendance Table")
    frame = Frame(root2)
    frame.pack()
    pt = Table(frame)
    pt.importCSV(filename)
    pt.show()
    root2.mainloop()
Ejemplo n.º 8
0
    def loaddataset():
        #root.destroy()
        root1 = Tk()
        root1.geometry('1600x8000')
        root1.title('Dataset')

        f = Frame(root1)
        tb = Table(f)
        f.pack(fill=BOTH, expand=True)
        tb.importCSV('data.csv')
        tb.show()
        root1.mainloop()
Ejemplo n.º 9
0
def show_data_table():

    path = open_path()
    if path == 'FileNotFoundError':
        error_box('Please upload data first.')
        return
    root = tk.Tk()
    root.title('STOCK ANALYST')

    frame = tk.Frame(root)
    frame.pack(fill='both', expand=True)
    datatable = Table(frame, showtoolbar=True, showstatusbar=True)
    datatable.show()
    '''shows data in the table'''
    datatable.importCSV(filename=path, dialog=False)
    root.mainloop()
Ejemplo n.º 10
0
class DataPanel():
    def __init__(self, root):
        self.frame3 = Tk.Frame(root)
        self.frame3.__init__()
        self.frame3.pack(fill=Tk.BOTH, expand=1)
        df = pandas.DataFrame()
        self.table = Table(self.frame3,
                           dataframe=df,
                           showtoolbar=True,
                           showstatusbar=True)
        self.table.show()

    def update(self, file_path):

        self.table.importCSV(file_path)
        self.table.redraw()
Ejemplo n.º 11
0
 def show_table():
     try:
         try:
             if root.state() == 'normal':
                root.focus()
         except Exception as e:
             root = tk.Toplevel()
             root.title("Show Table")
             root.geometry('800x500')
             root.configure(bg='#FFFFCC')
             frame = tk.Frame(root)
             frame.pack(fill=BOTH)
             table = Table(frame,showstatusbar=True,showtoolbar=True)
             table.importCSV(filename=r'G:\PYTHON\GUI\Passbuddy project\webinfo.csv')
             table.show()
         
     except Exception as e:
         permanent_row = ['Platformname','Username','Password','Email']
         f = open(r'G:\PYTHON\GUI\Passbuddy project\webinfo.csv','a')
         write = csv.writer(f)
         write.writerow(permanent_row)
         f.close()
Ejemplo n.º 12
0
Created on Sat Feb 22 19:33:18 2020

@author: Zhimin
"""
from tkinter import *
from pandastable import Table, TableModel
#assuming parent is the frame in which you want to place the table

root = Tk()
frame = Frame(root)
frame.pack()
#root.mainloop()

pt = Table(frame)
pt.show()
pt.importCSV('test.csv')
pt.mainloop()

class popupWindow(object):
    
    def changeBlock( self,event ):
        self.location = (event.x,event.y)
        print(str(event.x) + str(event.y))
        self.canvas.create_rectangle(event.x,event.y,event.x+10,event.y+10,fill='red')
        
    def __init__(self, master):
        top=self.top=Toplevel(master)
        top.minsize(width=800, height=600)
        self.canvas = Canvas(top, width=120, height=80, bg='black')
        self.canvas.pack(expand=YES, fill=BOTH)
        self.gif1 = PhotoImage(file='BP Baltimore Satellite.PNG')
Ejemplo n.º 13
0
from tkinter import *
from pandastable import Table
#assuming parent is the frame in which you want to place the table
pt = Table(parent)
pt.importCSV('example.csv')
pt.show()
Ejemplo n.º 14
0
            def merge_data():
                mergeWindow = Toplevel()
                mergeWindow.title("Merged Data Window")
                reader = csv.reader(open(dataFile[0]))
                reader1 = csv.reader(open(dataFile[1]))
                f = open("combined.csv", "w")
                writer = csv.writer(f)
                next(reader1)
                for row in reader:
                    writer.writerow(row)
                for row in reader1:
                    writer.writerow(row)
                f.close()
                frame = Frame(mergeWindow)
                frame.pack()

                pt = Table(frame)
                pt.show()

                pt.importCSV(filename='combined.csv', dialog=True)
                label = Label(mergeWindow, text="This is merged file", font=50)
                label.pack()
                dataPreprocessingLabel = Label(
                    mergeWindow,
                    text="Do you want data preprocessing on data?",
                    font=100)
                dataPreprocessingLabel.pack()

                def yes_clicked():
                    #Here we have to do data preprocessing
                    dataPreprocessingWindow = Toplevel()
                    dataPreprocessingWindow.title("Data Preprocessing Window")
                    dataPreprocessingWindow.geometry("700x700")
                    missing_values_indexes = StringVar()
                    icategorical_values_indexes = StringVar()
                    dcategorical_values_indexes = StringVar()

                    def ok_clicked():
                        try:
                            listOfMissingValuesIndexes = []
                            listOfICategoricalValuesIndexes = []
                            listOfDCategoricalValuesIndexes = []
                            index = missing_values_indexes.get()
                            iindex = icategorical_values_indexes.get()
                            dindex = dcategorical_values_indexes.get()
                            for i in index:
                                if (i == ' '):
                                    pass
                                else:
                                    ind = int(i)
                                    listOfMissingValuesIndexes.append(ind)
                            for i in iindex:
                                if (i == ' '):
                                    pass
                                else:
                                    ind = int(i)
                                    listOfICategoricalValuesIndexes.append(ind)
                            for i in dindex:
                                if (i == ' '):
                                    pass
                                else:
                                    ind = int(i)
                                    listOfDCategoricalValuesIndexes.append(ind)

                            print(listOfMissingValuesIndexes)
                            print(listOfICategoricalValuesIndexes)
                            print(listOfDCategoricalValuesIndexes)
                        except:
                            print(
                                "Your data doesn't have any categorical value")
                        finally:
                            import numpy as np
                            import matplotlib.pyplot as plt
                            import pandas as pd

                            dataset = pd.read_csv('combined.csv')
                            X = dataset.iloc[:, :-1].values
                            y = dataset.iloc[:, -1].values

                            print(X)
                            print(y)
                            try:
                                from sklearn.impute import SimpleImputer
                                imputer = SimpleImputer(missing_values=np.nan,
                                                        strategy='mean')
                                imputer.fit(X[:, listOfMissingValuesIndexes])
                                X[:,
                                  listOfMissingValuesIndexes] = imputer.transform(
                                      X[:, listOfMissingValuesIndexes])

                                print(X)

                                from sklearn.compose import ColumnTransformer
                                from sklearn.preprocessing import OneHotEncoder
                                ct = ColumnTransformer(transformers=[
                                    ('encoder', OneHotEncoder(),
                                     listOfICategoricalValuesIndexes)
                                ],
                                                       remainder='passthrough')
                                X = np.array(ct.fit_transform(X))
                                print(X)

                                from sklearn.preprocessing import LabelEncoder
                                le = LabelEncoder()
                                y = le.fit_transform(y)
                                print(y)
                            except:
                                print("No need")
                            finally:

                                from sklearn.model_selection import train_test_split
                                X_train, X_test, y_train, y_test = train_test_split(
                                    X, y, test_size=0.2, random_state=1)

                                Label(
                                    dataPreprocessingWindow,
                                    text=
                                    "This is metrices of features X after data preprocessing",
                                    bg="orange",
                                    font=50).grid()
                                Label(dataPreprocessingWindow, text=X,
                                      font=50).grid()
                                Label(
                                    dataPreprocessingWindow,
                                    text=
                                    "This is dependent variable y after data preprocessing",
                                    bg="orange",
                                    font=50).grid()
                                Label(dataPreprocessingWindow, text=y,
                                      font=50).grid()
                                Label(
                                    dataPreprocessingWindow,
                                    text=
                                    "Data set splitted into training set(80%) and test set(20%)",
                                    bg="orange",
                                    font=70).grid()

                        def move_forward_clicked():
                            chooseAlgoWindow = Toplevel()
                            chooseAlgoWindow.title("Choice is hard")
                            chooseAlgoWindow.geometry("700x700")
                            Label(
                                chooseAlgoWindow,
                                text=
                                "Choose what you want to do on your data(REGRESSION, CLASSIFICATION OR CLUSTERING)",
                                bg="antique white",
                                font=80).grid(row=0, column=0)

                            def regression():
                                def linear_regression():
                                    from sklearn.linear_model import LinearRegression
                                    regressor = LinearRegression()
                                    regressor.fit(X_train, y_train)
                                    #Predicting the test set results
                                    y_pred = regressor.predict(X_test)

                                    #Visualizing the training set results
                                    def train_set():
                                        plt.scatter(X_train[:, 0],
                                                    y_train,
                                                    color='red')
                                        plt.plot(X_train,
                                                 regressor.predict(X_train),
                                                 color='blue')
                                        plt.title('Training set')
                                        plt.show()

                                    #Visualizing the test set results
                                    def test_set():
                                        plt.scatter(X_test[:, 0],
                                                    y_test,
                                                    color='red')
                                        plt.plot(X_train,
                                                 regressor.predict(X_train),
                                                 color='blue')
                                        plt.title("Test set")
                                        plt.show()

                                    #Predicting new value
                                    def predict_new_value():
                                        new_value_predict = IntVar()
                                        Label(
                                            chooseAlgoWindow,
                                            text="Enter the value to predict",
                                            font=70).grid()
                                        Entry(chooseAlgoWindow,
                                              textvariable=new_value_predict,
                                              width=50).grid()

                                        def predict_clicked():
                                            value_to_predict = new_value_predict.get(
                                            )
                                            X_predict = [value_to_predict]
                                            y_predict = regressor.predict(
                                                [X_predict])
                                            Label(chooseAlgoWindow,
                                                  text="Predicted value is :-",
                                                  font=100).grid()
                                            Label(chooseAlgoWindow,
                                                  text=y_predict,
                                                  font=150).grid()

                                        Button(chooseAlgoWindow,
                                               text="Predict",
                                               fg="orange",
                                               command=predict_clicked,
                                               cursor="hand2").grid()

                                    Button(
                                        chooseAlgoWindow,
                                        text=
                                        "Click to visualize the train test result",
                                        bg="orange",
                                        fg="black",
                                        command=train_set,
                                        cursor="hand2").grid()
                                    Button(
                                        chooseAlgoWindow,
                                        text=
                                        "Click to visualize the test test result",
                                        bg="orange",
                                        fg="black",
                                        command=test_set,
                                        cursor="hand2").grid()
                                    Button(
                                        chooseAlgoWindow,
                                        text="Click here to predict new value",
                                        bg="orange",
                                        fg="black",
                                        command=predict_new_value,
                                        cursor="hand2").grid()

                                def multiple_linear_regression():
                                    from sklearn.linear_model import LinearRegression
                                    regressor = LinearRegression()
                                    regressor.fit(X_train, y_train)
                                    #Predicting the Test set results
                                    y_pred = regressor.predict(X_test)
                                    np.set_printoptions(precision=2)
                                    print(
                                        np.concatenate(
                                            (y_pred.reshape(len(y_pred), 1),
                                             y_test.reshape(len(y_test), 1)),
                                            1))
                                    Label(
                                        chooseAlgoWindow,
                                        text=
                                        "Here is the predicted test set result(FIRST COLUMN = TEST SET VALUE, SECOND COLUMN = PREDICTED VALUE)",
                                        bg="orange").grid()
                                    Label(chooseAlgoWindow,
                                          text=np.concatenate(
                                              (y_pred.reshape(len(y_pred), 1),
                                               y_test.reshape(len(y_test), 1)),
                                              1)).grid()

                                Label(chooseAlgoWindow,
                                      text="Ok...Which algo??",
                                      bg="orange",
                                      font=40).grid(row=4, column=1)
                                Button(chooseAlgoWindow,
                                       text="1.Simple Linear Regression",
                                       bg="linen",
                                       fg="black",
                                       command=linear_regression,
                                       cursor="hand2").grid(row=5, column=1)
                                Button(chooseAlgoWindow,
                                       text="2.Multiple Linear Regression",
                                       bg="linen",
                                       fg="black",
                                       command=multiple_linear_regression,
                                       cursor="hand2").grid(row=6, column=1)
                                Button(chooseAlgoWindow,
                                       text="3.Polynomial Regression",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=7, column=1)
                                Button(chooseAlgoWindow,
                                       text="4.Support Vector Regression",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=8, column=1)
                                Button(chooseAlgoWindow,
                                       text="5.Decision Tree Regression",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=9, column=1)
                                Button(chooseAlgoWindow,
                                       text="6.Random Forest Regression",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=10, column=1)

                            def classification():
                                Label(chooseAlgoWindow,
                                      text="Ok...Which algo??",
                                      bg="orange",
                                      font=40).grid(row=4, column=2)
                                Button(chooseAlgoWindow,
                                       text="1.Logistic Regression",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=5, column=2)
                                Button(chooseAlgoWindow,
                                       text="2.K-Nearest Neighbours",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=6, column=2)
                                Button(chooseAlgoWindow,
                                       text="3.Support Vector Machine",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=7, column=2)
                                Button(chooseAlgoWindow,
                                       text="4.Kernel SVM",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=8, column=2)
                                Button(chooseAlgoWindow,
                                       text="5.Naive Byes",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=9, column=2)
                                Button(chooseAlgoWindow,
                                       text="6.Decision Tree Classification",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=10, column=2)
                                Button(chooseAlgoWindow,
                                       text="7.Random Forest Classification",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=11, column=2)

                            def clustering():
                                Label(chooseAlgoWindow,
                                      text="Ok...Which algo??",
                                      bg="orange",
                                      font=40).grid(row=4, column=3)
                                Button(chooseAlgoWindow,
                                       text="1.K-Means Clustering",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=5, column=3)
                                Button(chooseAlgoWindow,
                                       text="2.Heirarchical Clustering",
                                       bg="linen",
                                       fg="black",
                                       cursor="hand2").grid(row=6, column=3)

                            Button(chooseAlgoWindow,
                                   text="REGRESSION",
                                   bg="linen",
                                   fg="black",
                                   height=2,
                                   width=30,
                                   command=regression,
                                   cursor="hand2").grid(row=3, column=1)
                            Button(chooseAlgoWindow,
                                   text="CLASSIFICATION",
                                   bg="linen",
                                   fg="black",
                                   height=2,
                                   width=30,
                                   command=classification,
                                   cursor="hand2").grid(row=3, column=2)
                            Button(chooseAlgoWindow,
                                   text="CLUSTERING",
                                   bg="linen",
                                   fg="black",
                                   height=2,
                                   width=30,
                                   command=clustering,
                                   cursor="hand2").grid(row=3, column=3)

                        Button(dataPreprocessingWindow,
                               text="Move Forward",
                               bg="orange",
                               fg="linen",
                               command=move_forward_clicked,
                               cursor="hand2").grid()

                    Label(
                        dataPreprocessingWindow,
                        text=
                        "Enter indexes(space separated) that can contain missing data",
                        font=70).grid(row=0, column=0)
                    Entry(dataPreprocessingWindow,
                          textvariable=missing_values_indexes,
                          width=50).grid()
                    Label(
                        dataPreprocessingWindow,
                        text=
                        "Enter indexes(space separated) of independent variables that can contain categorical data",
                        font=70).grid()
                    Entry(dataPreprocessingWindow,
                          textvariable=icategorical_values_indexes,
                          width=50).grid()
                    Button(dataPreprocessingWindow,
                           text="OK",
                           command=ok_clicked,
                           cursor="hand2").grid()

                def no_clicked():
                    messagebox.showinfo(
                        "Recommendation",
                        "We recommend you to do data preprocessing before moving forward!"
                    )

                yesButton = Button(mergeWindow,
                                   text="Yes(RECOMMENDED)",
                                   height=2,
                                   width=20,
                                   bg="linen",
                                   command=yes_clicked,
                                   cursor="hand2")
                yesButton.pack()
                noButton = Button(mergeWindow,
                                  text="No",
                                  height=2,
                                  width=20,
                                  command=no_clicked,
                                  bg="linen",
                                  cursor="hand2")
                noButton.pack()
                Label(
                    mergeWindow,
                    text=
                    "Make sure before clicking on YES that the dependent variable is the last column in data",
                    font=100).pack()
                Label(
                    mergeWindow,
                    text=
                    "Or if you want clustering on data then click the below button",
                    font=100,
                    bg="orange",
                    fg="black").pack()

                def clusteringClicked():
                    Label(
                        mergeWindow,
                        text=
                        "Which algo?? Choose the right algo according to the data",
                        bg="green yellow").pack()
                    Button(mergeWindow,
                           text="K-Means Algorithm",
                           bg="linen",
                           fg="black",
                           cursor="hand2").pack()
                    heirarchicalButton = Button(mergeWindow,
                                                text="Heirarchical Clustering",
                                                bg="linen",
                                                fg="black",
                                                cursor="hand2").pack()

                clusteringButton = Button(mergeWindow,
                                          text="Click Here For Clustering",
                                          height=2,
                                          width=20,
                                          command=clusteringClicked,
                                          cursor="hand2")
                clusteringButton.pack()