Example #1
0
    def put_songs(self):
        # Set height and width of scroll frame
        sf_width = 7 / 10 * self.width
        sf_height = 4 / 5 * self.height

        # Create scrolled frame and place it
        sf = ScrolledFrame(self.root, width=sf_width, height=sf_height)
        sf.place(x=(1 / 5 * self.width), y=(1 / 15 * self.height))

        # Bind the arrow keys and scroll wheel
        sf.bind_arrow_keys(self.root)
        sf.bind_scroll_wheel(self.root)

        # Create a frame within the ScrolledFrame
        inner_frame = sf.display_widget(Frame)

        # Getting the number of songs and creating the appropriate number of rows and columns
        number_of_songs = len(os.listdir(self.folder))
        num_cols = 4
        row_temp = float(number_of_songs / num_cols)
        if not row_temp.is_integer():
            num_rows = int(row_temp) + 1
        else:
            num_rows = int(row_temp)

        # Creating a list of all the songs
        songs = list()
        
        song_folders = os.listdir('D:\\SongPlayer\\songs\\')
        for folder in song_folders:
            songs.append(MusicInterpreter(self.folder, folder))

        # Creating a list of pics
        pics = list()
        pic_counter = 0

        # Determining the size of the icon
        icon_size_dimension = int(sf_width / num_cols)
        music_counter = 0

        # Looping through the songs and creating a button for each song
        for row in range(num_rows):
            for column in range(num_cols):
                # This if statement determines if there are more songs to make
                if music_counter < number_of_songs:
                    music = songs[music_counter]
                    mir = Image.open(music.getPic()).resize((icon_size_dimension, icon_size_dimension), Image.ANTIALIAS)
                    pics.append(ImageTk.PhotoImage(mir))
                    # Creates the music button
                    MI = MusicIcon(self, inner_frame, music, pics[pic_counter], icon_size_dimension)
                    w = MI.get_button()
                    music_counter += 1
                    pic_counter += 1

                # putting it in grid layout
                w.grid(row=row,
                       column=column,
                       padx=0,
                       pady=0)
Example #2
0
def create_column(currentValue):
    show_scroll=tk.Label(canvas,text="Choose word to replace" ,bg='#6DD5ED', bd=10)
    show_scroll.place(relx=0.5, rely=0.4, relwidth=0.8, relheight=0.05, anchor='n')
    sf = ScrolledFrame(canvas)
    sf.place(relx=0.5, rely=0.45, relwidth=0.8, relheight=0.35, anchor='n')

    # Bind the arrow keys and scroll wheel
    sf.bind_arrow_keys(canvas)
    sf.bind_scroll_wheel(canvas)

    # Create a frame within the ScrolledFrame
    inner_frame = sf.display_widget(tk.Frame)
    global general_checkbuttons
    general_checkbuttons = {}
    col=3
    counterX=0
    counterY=0
    arrayAns=[]
   # print(currentValue)
    # currentValue=["A","B","C","D","A","B","C","D","A","B","C","D","A","B","C","D"]
    root.grid_columnconfigure(4, minsize=50)
    for i in range(len(currentValue)):
        for y in range(col):
            if counterX % col!= 0 or i==0:
                cal=i%col

                cb = tk.Checkbutton(inner_frame, font=(None, 12),variable=currentValue[i],text=currentValue[i], wraplength=250)
                cb.grid(row=counterY, column=cal, sticky="w", pady=1, padx=1)
                general_checkbuttons[i] = cb
                break
            elif counterX %col ==0:
                cal=i%col


                counterY+=1
                cb = tk.Checkbutton(inner_frame, font=(None, 12),variable=currentValue[i],text=currentValue[i], wraplength=250)

                cb.grid(row=counterY, column=cal, sticky="w", pady=1, padx=1)
                general_checkbuttons[i] = cb
                break

        counterX+=1
    frameSearch=tk.Frame(canvas,bd=5,bg="#6DD5ED")
    frameSearch.place(rely=0.80,relx=0.1,relwidth=0.74, relheight=0.04)
    entrySearch=tk.Entry(frameSearch)
    entrySearch.place(relwidth=1)
    entrySearch.insert(0, 'Search for words')
    entrySearch.bind("<FocusIn>", lambda args: entrySearch.delete('0', 'end'))

    entrySearch.bind("<KeyPress>", lambda args: valueSearch(entrySearch.get(),currentValue))


    
    


    buttonWord = tk.Button(canvas, text='Choose Word', command=lambda:extractChecked(general_checkbuttons,currentValue,True))
    buttonWord.place(rely=0.80,relx=0.84)
Example #3
0
    def _build(self):
        self._label_selected = Label(master=self, text=f'{lang["pu_curr_elements"]}', bg='darkgray')
        self._label_selected.place(in_=self, x=10, y=10)

        container = ScrolledFrame(master=self, bg='darkgray', width=465, height=75, borderwidth=1, relief="solid",
                                  scrollbars="vertical")
        container.place(in_=self, x=10, y=30)
        self._frame_selected = container.display_widget(Frame, bg='darkgray', width=465)

        self._label_choice = Label(master=self, text=f'{lang["pu_choice_elements"]}', bg='darkgray')
        self._label_choice.place(in_=self, x=10, y=110)

        container = ScrolledFrame(master=self, bg='darkgray', width=465, height=75, borderwidth=1, relief="solid",
                                  scrollbars="vertical")
        container.place(in_=self, x=10, y=130)
        self._frame_choice = container.display_widget(Frame, bg='darkgray', width=465)

        super()._build()
        self._resize()
        pass
Example #4
0
def draw_frame_2(elapsed_time, root):
    sf = ScrolledFrame(root, bg=greenILike)
    sf.place(relwidth=1, relheight=1)

    sf.bind_arrow_keys(root)
    sf.bind_scroll_wheel(root)

    frame2 = sf.display_widget(Frame, bg=greenILike)

    l = tk.Label(frame2,
                 text="Sorted Results",
                 font=('Helvetica', 30, 'normal'),
                 bg=greenILike)
    st = "Time taken:  " + str(elapsed_time)
    l1 = tk.Label(frame2,
                  text=st,
                  font=('Helvetica', 15, "normal"),
                  bg=greenILike)
    l.grid(row=0, column=1, columnspan=4)
    l1.grid(row=1, column=1, columnspan=4)

    tk.Label(frame2,
             padx=20,
             text="Name",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2, column=0, pady=2, sticky='w')
    tk.Label(frame2,
             text="Time",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2, column=2, pady=2)
    tk.Label(frame2,
             padx=10,
             text="Calories",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2, column=3, pady=2)
    tk.Label(frame2,
             padx=10,
             text="Steps",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2, column=4, pady=2)
    tk.Label(frame2,
             padx=10,
             text="No Ingredients",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2, column=5, pady=2)
    tk.Label(frame2,
             padx=20,
             text="Ingredients",
             font=('Helvetica', 12, 'bold'),
             bg=greenILike).grid(row=2,
                                 column=6,
                                 columnspan=2,
                                 pady=2,
                                 sticky='w')
    for i in range(3, min(len(recipe_list.recipes) - 1, 300)):
        tk.Label(frame2,
                 padx=20,
                 text=recipe_list.recipes[i - 3].name,
                 bg=greenILike).grid(row=i,
                                     column=0,
                                     columnspan=2,
                                     pady=2,
                                     sticky='w')
        tk.Label(frame2,
                 text=str(recipe_list.recipes[i - 3].minutes),
                 bg=greenILike).grid(row=i, column=2, pady=2)
        tk.Label(frame2,
                 text=str(recipe_list.recipes[i - 3].calories),
                 bg=greenILike).grid(row=i, column=3, pady=2)
        tk.Label(frame2,
                 text=str(recipe_list.recipes[i - 3].n_s),
                 bg=greenILike).grid(row=i, column=4, pady=2)
        tk.Label(frame2,
                 text=str(recipe_list.recipes[i - 3].n_i),
                 bg=greenILike).grid(row=i, column=5, pady=2)
        tk.Label(frame2,
                 padx=20,
                 text=recipe_list.recipes[i - 3].ing_info(),
                 bg=greenILike).grid(row=i,
                                     column=6,
                                     columnspan=2,
                                     pady=2,
                                     sticky='w')

    button3 = tk.Button(frame2,
                        text="GO BACK",
                        bg='yellow',
                        command=lambda: goBack(root))
    button3.grid(row=0, column=5)
    def __init__(self, win):

        sf = ScrolledFrame(win, width=1510, height=620)
        sf.place(x=0, y=152)
        # sf.pack(side="top",expand=1,fill="both")

        sf.bind_arrow_keys(win)
        sf.bind_scroll_wheel(win)

        canvas = sf.display_widget(Canvas)
        canvas.config( width=1610, height=1200)

        mydb = mysql.connector.connect(host="localhost", user="******", passwd="Meezan#2018", database="ice_creame")
        list5 = []

        cursor = mydb.cursor()
        cursor.execute("select bill_id from bill_records")
        list6 = cursor.fetchall()

        cursor.execute("select bill_date from bill_records")
        list1 = cursor.fetchall()
        # print(tabulate(list))

        cursor.execute("select customer_name from bill_records")
        list2 = cursor.fetchall()

        cursor.execute("select pro_name from bill_records")
        list3 = cursor.fetchall()

        cursor.execute("select pro_quantity from bill_records")
        list4 = cursor.fetchall()

        cursor.execute("select sub_total from bill_records")
        list5 = cursor.fetchall()

        title1 = Label(canvas,  text="Bill ID", font=("calibri Bold", 15)).place(x=70, y=90)

        title2 = Label(canvas,  text="Date", font=("calibri Bold", 15)).place(x=190, y=90)

        title3 = Label(canvas,  text="Customer", font=("calibri Bold", 15)).place(x=280, y=90)

        title4 = Label(canvas,  text="Products", font=("calibri Bold", 15)).place(x=700, y=90)

        title5 = Label(canvas,  text="Quantity", font=("calibri Bold", 15)).place(x=1220, y=90)

        title6 = Label(canvas,  text="Sub Total", font=("calibri Bold", 15)).place(x=1350, y=90)

        ym1 = 90
        for m in range(0, list6.__len__()):
            label = Label(canvas,  text=list6[m], font=("calibri regular", 15))
            ym1 = ym1 + 40
            label.place(x=70, y=ym1)

        l1 = list(list1)
        ind = 0

        ym2 = 0
        y1 = 100
        y2 = 90
        for m in range(0, list1.__len__()):
            a = str(l1[ind])

            c = a.replace("('", "")
            d = c.replace("',)", "")

            label = Label(canvas,  text=d, font=("calibri regular", 15))
            y2 = y2 + 40
            ind = ind + 1
            label.place(x=140, y=y2)
            y1 = y2 + 35
            ym2 = y1
            canvas.create_line(40, y1, 1450, y1, fill='black')

        y2 = 90

        for i in range(0, list2.__len__()):
            label = Label(canvas,  text=list2[i], font=("calibri regular", 15))
            y2 = y2 + 40
            label.place(x=290, y=y2)

        canvas.create_line(40, 80, 1450, 80, fill='black')

        canvas.create_line(40, 120, 1450, 120, fill='black')

        canvas.create_line(40, 80, 40, ym2, fill='black')
        canvas.create_line(130, 80, 130, ym2, fill='black')
        canvas.create_line(250, 80, 250, ym2, fill='black')
        canvas.create_line(390, 80, 390, ym2, fill='black')
        canvas.create_line(1200, 80,1200, ym2, fill='black')
        canvas.create_line(1320, 80,1320, ym2, fill='black')
        canvas.create_line(1450, 80,1450, ym2, fill='black')

        '''l3 = list(list3)
        ind = 0
        print(l3)'''

        y2 = 90
        for i in range(0, list3.__len__()):
            '''a = str(l3[ind])

            c = a.replace("('", "")
            d = c.replace("',)", "")'''

            label = Label(canvas,  text=list3[i], font=("calibri regular", 15))
            y2 = y2 + 40
            label.place(x=430, y=y2)

        y2 = 90
        for i in range(0, list4.__len__()):
            label = Label(canvas,  text=list4[i], font=("calibri regular", 15))
            y2 = y2 + 40
            label.place(x=1240, y=y2)



        y2 = 90
        for i in range(0,list5.__len__()):


            label = Label(canvas,  text=list5[i], font=("calibri regular", 15))
            y2 = y2 + 40
            ind = ind + 1
            label.place(x=1370, y=y2)
Example #6
0
def create_columns_skeleton(currentValue, hasSearch):

    show_scroll = tk.Label(canvas,
                           text="Choose word to replace",
                           bg='#6DD5ED',
                           bd=10)
    show_scroll.place(relx=0.5,
                      rely=0.4,
                      relwidth=0.8,
                      relheight=0.05,
                      anchor='n')
    sf = ScrolledFrame(canvas)
    sf.place(relx=0.5, rely=0.45, relwidth=0.8, relheight=0.35, anchor='n')

    # Bind the arrow keys and scroll wheel
    sf.bind_arrow_keys(canvas)
    sf.bind_scroll_wheel(canvas)

    # Create a frame within the ScrolledFrame
    inner_frame = sf.display_widget(tk.Frame)

    general_checkbuttons = {}
    col = 3
    counterX = 0
    counterY = 0
    arrayAns = []
    global general_var
    # print(currentValue)
    # currentValue=["A","B","C","D","A","B","C","D","A","B","C","D","A","B","C","D"]
    root.grid_columnconfigure(4, minsize=50)

    for i in range(len(currentValue)):
        textVal = str(currentValue[i]
                      ) if currentValue[i] == currentValue[i] else "<Blank>"
        if hasSearch:
            var = general_var[textVal]
        else:
            var = tk.IntVar()
        for y in range(col):
            if counterX % col != 0 or i == 0:

                cal = i % col
                cb = tk.Checkbutton(inner_frame,
                                    font=(None, 12),
                                    variable=var,
                                    text=textVal,
                                    wraplength=250)
                cb.grid(row=counterY, column=cal, sticky="w", pady=1, padx=1)
                general_checkbuttons[i] = cb
                general_var[textVal] = var
                break
            elif counterX % col == 0:
                cal = i % col

                counterY += 1
                cb = tk.Checkbutton(inner_frame,
                                    font=(None, 12),
                                    variable=var,
                                    text=textVal,
                                    wraplength=250)

                cb.grid(row=counterY, column=cal, sticky="w", pady=1, padx=1)
                general_checkbuttons[i] = cb
                general_var[textVal] = var
                break

        counterX += 1
    if not hasSearch:
        return general_checkbuttons
Example #7
0
    bg='#0052cc',
    fg='#ffffff',
    activebackground='#0052cc',
    activeforeground='#aaffaa',
    command=doAnomalyDetection)
showAnomalyDetectionButton['font'] = myFont
showAnomalyDetectionButton.place(x=990, y=0)

downloadButton = Tkinter.Button(app,
                                text='Download CSV',
                                width=20,
                                height=3,
                                bg='#0052cc',
                                fg='#ffffff',
                                activebackground='#0052cc',
                                activeforeground='#aaffaa',
                                command=downloadCSV)
downloadButton['font'] = myFont
downloadButton.place(x=1480, y=0)

sf = ScrolledFrame(app, width=1780, height=660)
sf.place(x=5, y=120)

# Bind the arrow keys and scroll wheel
sf.bind_arrow_keys(app)
sf.bind_scroll_wheel(app)

inner_frame_csv = sf.display_widget(Tkinter.Frame)

app.mainloop()
Example #8
0
    def __init__(self, win):

        sf = ScrolledFrame(win, width=1210, height=620)
        sf.place(x=300, y=152)
        #sf.pack(side="top",expand=1,fill="both")

        sf.bind_arrow_keys(win)
        sf.bind_scroll_wheel(win)

        canvas = sf.display_widget(Canvas)
        canvas.config(bg="bisque2", width=1210, height=1000)

        mydb = mysql.connector.connect(host="localhost",
                                       user="******",
                                       passwd="Meezan#2018",
                                       database="ice_creame")
        list5 = []
        cursor = mydb.cursor()
        cursor.execute("select pro_id from products")
        list6 = cursor.fetchall()

        cursor.execute("select pro_name from products")
        list1 = cursor.fetchall()
        # print(tabulate(list))

        cursor.execute("select pro_cat from products")
        list2 = cursor.fetchall()

        cursor.execute("select pro_quant from products")
        list3 = cursor.fetchall()

        cursor.execute("select pro_price from products")
        list4 = cursor.fetchall()

        cursor.execute("select decp from products")
        list5 = cursor.fetchall()

        title1 = Label(canvas,
                       bg="bisque2",
                       text="ID",
                       font=("calibri Bold", 15)).place(x=70, y=90)

        title2 = Label(canvas,
                       bg="bisque2",
                       text="Product Name",
                       font=("calibri Bold", 15)).place(x=190, y=90)

        title3 = Label(canvas,
                       bg="bisque2",
                       text="Category",
                       font=("calibri Bold", 15)).place(x=450, y=90)

        title4 = Label(canvas,
                       bg="bisque2",
                       text="Quantity",
                       font=("calibri Bold", 15)).place(x=600, y=90)

        title5 = Label(canvas,
                       bg="bisque2",
                       text="Price",
                       font=("calibri Bold", 15)).place(x=720, y=90)

        title6 = Label(canvas,
                       bg="bisque2",
                       text="Description",
                       font=("calibri Bold", 15)).place(x=900, y=90)

        ym1 = 90
        for m in range(0, list6.__len__()):
            label = Label(canvas,
                          bg="bisque2",
                          text=list6[m],
                          font=("calibri regular", 15))
            ym1 = ym1 + 40
            label.place(x=70, y=ym1)

        l1 = list(list1)
        ind = 0

        ym2 = 0
        y1 = 100
        y2 = 90
        for m in range(0, list1.__len__()):

            a = str(l1[ind])

            c = a.replace("('", "")
            d = c.replace("',)", "")

            label = Label(canvas,
                          bg="bisque2",
                          text=d,
                          font=("calibri regular", 15))
            y2 = y2 + 40
            ind = ind + 1
            label.place(x=140, y=y2)
            y1 = y2 + 35
            ym2 = y1
            canvas.create_line(40, y1, 1200, y1, fill='black')

        y2 = 90

        for i in range(0, list2.__len__()):
            label = Label(canvas,
                          bg="bisque2",
                          text=list2[i],
                          font=("calibri regular", 13))
            y2 = y2 + 40
            label.place(x=410, y=y2)

        canvas.create_line(40, 80, 1200, 80, fill='black')

        canvas.create_line(40, 120, 1200, 120, fill='black')

        canvas.create_line(40, 80, 40, ym2, fill='black')
        canvas.create_line(130, 80, 130, ym2, fill='black')
        canvas.create_line(390, 80, 390, ym2, fill='black')
        canvas.create_line(590, 80, 590, ym2, fill='black')
        canvas.create_line(700, 80, 700, ym2, fill='black')
        canvas.create_line(800, 80, 800, ym2, fill='black')
        canvas.create_line(1200, 80, 1200, ym2, fill='black')

        a = ""
        temp1 = 0
        temp2 = 0
        for i in range(0, list2.__len__()):
            a = list1[i]

            n = a.__len__()
            temp1 = n
            if (temp1 > temp2):
                print(list1[i])
            temp2 = temp1

        y2 = 90
        for i in range(0, list3.__len__()):
            label = Label(canvas,
                          bg="bisque2",
                          text=list3[i],
                          font=("calibri regular", 15))
            y2 = y2 + 40
            label.place(x=620, y=y2)

        y2 = 90
        for i in range(0, list4.__len__()):
            label = Label(canvas,
                          bg="bisque2",
                          text=list4[i],
                          font=("calibri regular", 15))
            y2 = y2 + 40
            label.place(x=730, y=y2)

        l5 = list(list5)
        ind = 0

        y2 = 90
        for i in range(0, l5.__len__()):
            a = str(l5[ind])

            c = a.replace("('", "")
            d = c.replace("',)", "")

            label = Label(canvas,
                          bg="bisque2",
                          text=d,
                          font=("calibri regular", 15))
            y2 = y2 + 40
            ind = ind + 1
            label.place(x=810, y=y2)