Пример #1
0
class MainApp:
    def __init__(self):
        self.pre = None
        #model to predict
        self.model = Model()
        #creating root
        self.root = Tk()
        self.root.title("Digit Recognizer")
        self.root.resizable(0,0)
        #Gui elements
        self.lbl_drawhere = LabelFrame(text = 'Draw Here With Mouse')
        self.area_draw = Canvas(self.lbl_drawhere, width = 504,
                                height = 504, bg ='black')
        self.area_draw.bind('<B1-Motion>',self.draw)
        
        self.btn_reset = Button(self.lbl_drawhere, text = "Reset Drawing",
                                bg = "lightblue",command = self.reset_drawing)
        self.btn_predict = Button(self.root, text = 'Predict Digit',
                                  bg = "blue", command = self.predict_digit)
        
        #Fitting in th Gui
        self.lbl_drawhere.pack(in_=self.root, side = LEFT, fill = X)
        self.area_draw.pack()
        self.btn_reset.pack()
        self.btn_predict.pack(in_=self.root, side = LEFT)
        
    def draw(self,event):
        self.area_draw.create_oval(event.x,event.y,event.x+27,event.y+27,
                                   outline='white',fill = 'white')
        self.area_draw.create_rectangle(event.x,event.y,event.x+25,event.y+25,
                                        outline = 'white',fill = 'white')
        self.pre = 'D'
    
    def run(self):
        self.root.mainloop()
        
    def reset_drawing(self):
        self.area_draw.delete('all')
    
    def predict_digit(self):
        if(self.pre == None):
            messagebox.showerror(title = 'No Images',
                                 messgae = 'First Draw a number')
        else:
            x = self.root.winfo_rootx() + self.area_draw.winfo_x()
            y = self.root.winfo_rooty() + self.area_draw.winfo_y()
            x1 = x + self.area_draw.winfo_width()
            y1 = y + self.area_draw.winfo_height()
            ImageGrab.grab(bbox = (x,y+10,x1,y1)).save('image.png')
            messagebox.showinfo(
                    title = 'Prediction' , 
                    message = "Number: {}".format(self.model.predict()))
Пример #2
0
def chamarTelaListaMusicas():
    janela = Tk()
    janela.title("Lista de Músicas")
    telaL = 500
    telaA = 400
    telaLargura = janela.winfo_screenwidth()
    telaAltura = janela.winfo_screenheight()
    x = (telaLargura / 2) - (telaL / 2)
    y = (telaAltura / 2) - (telaA / 2)
    janela.geometry("%dx%d+%d+%d" % (telaL, telaA, x, y))
    janela.iconbitmap("icones/icon_player.ico")
    for i in range(len(lista)):
        Label(text='- ' + lista[i]).pack()
    janela.mainloop()
Пример #3
0
def openDF(df):
    df_window = Tk()
    df_window.title("Findings")
    cols = list(df.columns)
    tree = ttk.Treeview(df_window)
    tree.pack()
    tree["columns"] = cols
    for i in cols:
        tree.column(i, anchor="w")
        tree.heading(i, text=i, anchor='w')

    for index, row in df.iterrows():
        tree.insert("", 0, text=index, values=list(row))
    df_window.mainloop()
Пример #4
0
def drawNetworkx(figure):
    Netw = Tk()
    Netw.wm_title("Network")
    #f = plt.Figure(figsize=(5,4), dpi=100)
    #a = f.add_subplot(111)
    #a.plot([1,2,3,4,5],[3,2,1,3,4])
    #nx.draw_kamada_kawai(figure,with_labels=True, ax=a)
    canvas = FigureCanvasTkAgg(figure, master=Netw)
    canvas.draw()
    canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=True)
    #toolbar = NavigationToolbar2Tk(canvas, Netw)
    #toolbar.update()
    #canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
    Netw.mainloop()
def details():

    master = Tk()
    label00 = tkinter.Label(master,
                            text="Close me",
                            font=('Algerian', -35),
                            bg='#ffad99')
    label00.grid(row=0, column=0, columnspan=3)
    text1 = tk.Text(mainWindow)
    photo = tk.PhotoImage(file='D:\Project\Files\detail1.png')
    text1.insert(tk.END, '\n')
    text1.image_create(tk.END, image=photo)
    text1.grid(row=1, rowspan=7, column=3)
    master.mainloop()
Пример #6
0
def add_user():
    root1 = Tk()
    root1.title("User Registration")
    Label(root1, text="Employee Name",
          font=('eras bold itc', 12)).grid(row=0, sticky=W)
    Label(root1, text="Employee ID", font=('eras bold itc', 12)).grid(row=1,
                                                                      sticky=W)
    Label(root1, text="Age", font=('eras bold itc', 12)).grid(row=2, sticky=W)
    Label(root1, text="Department", font=('eras bold itc', 12)).grid(row=3,
                                                                     sticky=W)
    Label(root1, text="Phone Number",
          font=('eras bold itc', 12)).grid(row=4, sticky=W)
    Fname = Entry(root1)
    Fname.grid(row=0, column=1)

    id = Entry(root1)
    id.grid(row=1, column=1)

    age = Entry(root1)
    age.grid(row=2, column=1)

    dept = Entry(root1)
    dept.grid(row=3, column=1)

    phone = Entry(root1)
    phone.grid(row=4, column=1)

    root1.grid_columnconfigure(1, minsize=150)
    root1.geometry("290x160")

    def getInput():
        global params1
        global params2
        global params3
        global params4
        global params5
        params1 = Fname.get()
        params2 = id.get()
        params3 = age.get()
        params4 = dept.get()
        params5 = phone.get()
        root1.destroy()

    Button(root1,
           text="Submit",
           font=('cooper black', 12),
           command=lambda: [getInput(), capture()]).grid(row=5, sticky=W)
    root1.mainloop()
Пример #7
0
def adicionarMusica():
    global listaNomes, opcoes, lista, musica_e, z, fundo, cor_fundo_escolhida, botao_play, valor_play_pause
    jatem = False
    root = Tk()
    root.geometry('0x0')
    root.overrideredirect(False)
    root.iconbitmap('icones\icon_player.ico')
    opcoes['defaultextension'] = '.mp3'
    opcoes['filetypes'] = [('arquivos .mp3', '.mp3')]
    opcoes['initialdir'] = ''  # será o diretório atual
    opcoes['initialfile'] = ''  #apresenta todos os arquivos no diretorio
    opcoes['title'] = 'Selecione a música'
    nome_musica = askopenfile(mode='r', **opcoes)
    root.destroy()
    root.mainloop()
    try:
        fundo.fill(cor_fundo_escolhida)
        d = nome_musica.name
        f = d.split('/')
        w = f[len(f) - 1]
        w = w.split('.')
        if d in listaNomes:
            pyautogui.alert(text='A música \"' + w[0] +
                            '\" já encontra-se na lista!',
                            title='',
                            button='OK')
            listaNomes = listaNomes
            lista = lista
            jatem = True
        else:
            try:
                pygame.mixer.music.load(d)
                pygame.mixer.music.play()
                listaNomes.append(nome_musica.name)
                lista.append(w[0])
                musica_e = w[0]
                z = len(lista) - 1
            except:
                pyautogui.alert(text='Não foi possível reproduzir a música!',
                                title='Erro',
                                button='OK')
        if valor_play_pause == 1 and jatem == False:
            botao_play = pygame.image.load("icones\icon_play_pause.png")
            valor_play_pause = 0
    except AttributeError as error:
        listaNomes = listaNomes
        lista = lista
    salvarLista()
Пример #8
0
def chamarTelaListaMusicas():
    janela = Tk()
    janela.title("Lista de Músicas")
    telaL = 500
    telaA = 400
    telaLargura = janela.winfo_screenwidth()
    telaAltura = janela.winfo_screenheight()
    x = (telaLargura / 2) - (telaL / 2)
    y = (telaAltura / 2) - (telaA / 2)
    janela.geometry("%dx%d+%d+%d" % (telaL, telaA, x, y))
    janela.iconbitmap(
        "C:/Users/Romão/PycharmProjects/Exercicios-Python/exercicios/icone.ico"
    )
    for i in range(len(lista)):
        Label(text='- ' + lista[i]).pack()

    janela.mainloop()
def mainloop(file):
    global window
    global entry
    global txt
    global author
    global send_to
    send_to = None
    author = file
    sock = socket.socket()
    sock.connect(('25.95.4.168', 10001))
    sock.send((file + ' connect').encode('utf-8'))
    data = sock.recv(1024).decode('utf-8')
    sock.close()
    window = Tk()
    window.resizable(False, False)
    window.title(file)
    window.geometry("800x800")
    while True:
        quit_btn = Button(window, text="Выйти", command=quit, bg="red")
        send_btn = Button(window, text="Отправить", command=send, bg="green")
        data = data.replace(file, "")
        accounts = data.split()
        frame = Frame(window)
        frame.place(x=200, y=0, width=600, height=600)
        txt = Text(frame, width=580, height=600, wrap=NONE, state=DISABLED)
        txt.pack(side="left")
        n = 0
        for i in accounts:
            funk = partial(update, file, i)
            Button(window, command=funk, text=i).place(x=0,
                                                       y=n * 120,
                                                       width=200,
                                                       height=120)
            n += 1
        scroll = Scrollbar(frame, command=txt.yview, orient=VERTICAL, width=20)
        scroll.pack(side=RIGHT, fill=Y)
        txt.config(yscrollcommand=scroll.set)
        entry = Entry(window)
        quit_btn.place(x=200, y=695, width=100, height=50)
        send_btn.place(x=500, y=695, width=100, height=50)
        entry.place(x=200, y=600, width=600, height=40)
        window.mainloop()
        update(file, send_to)
Пример #10
0
def openGUI():
    #Defining the Tkinter Window
    root = Tk()
    root.title("CZ4071 Faculty Visualiser")
    root.geometry("450x230")

    #to call from Science.py
    data = Networks()

    #to program "Show" button
    def show(btn):
        btn.config(state='disabled')
        isGraph = 1
        if option_network.get() == "SCSE":
            if option_graph.get() == "Degree Distribution":
                graph, no, need = GetScseDegreeDistribution(
                    data.GetScseNetwork())

            elif option_graph.get() == "Publication Distribution":
                graph = GetScsePublicationDistribution(data.GetScseNetwork())

            elif option_graph.get() == "Reputation Distribution":
                graph, no, need = GetScseReputationDistribution(
                    data.GetScseNetwork())

            elif option_graph.get() == "Reputation Degree":
                graph = GetCoauthorReputationDegree(data.GetScseNetwork())

            elif option_graph.get() == "Maximum Degree Change":
                graph = GetCoauthorMaximumDegreeChange(data.GetScseNetwork())

        elif option_network.get() == "Coauthor":
            if option_graph.get() == "Degree Distribution":
                graph, no, need = GetScseDegreeDistribution(
                    data.GetCoauthorNetwork())

        elif option_network.get() == "Faculty Comparisons":
            isGraph = 0
            rank2 = None

            # filter by position
            if option_factor.get() == "position":
                filter = 'position'
                if option_graph.get() == "Professor":
                    rank1 = "Professor"
                elif option_graph.get() == "Associate Professor":
                    rank1 = "Associate Professor"
                elif option_graph.get() == "Assistant Professor":
                    rank1 = "Assistant Professor"
                elif option_graph.get() == "Lecturer":
                    rank1 = "Lecturer"

                if option_graph2.get() == "None":
                    rank2 = None
                elif option_graph2.get() == "Professor":
                    rank2 = "Professor"
                elif option_graph2.get() == "Associate Professor":
                    rank2 = "Associate Professor"
                elif option_graph2.get() == "Assistant Professor":
                    rank2 = "Assistant Professor"
                elif option_graph2.get() == "Lecturer":
                    rank2 = "Lecturer"

            # filter by management
            elif option_factor.get() == "management":
                filter = 'management'
                if option_graph.get() == "Y":
                    rank1 = "Y"
                elif option_graph.get() == "N":
                    rank1 = "N"
                if option_graph2.get() == "Y":
                    rank2 = "Y"
                elif option_graph2.get() == "N":
                    rank2 = "N"

            # filter by area of discipline
            elif option_factor.get() == "area":
                filter = 'area'
                for option in measures4:
                    if option_graph.get() == option:
                        rank1 = option

                if option_graph2.get() == "None":
                    rank2 = None
                for option in measures4:
                    if option_graph2.get() == option:
                        rank2 = option

            isGraph = 0
            graph = compareFiltered(data.GetScseNetwork(), filter, rank1,
                                    rank2)

        btn.config(state='normal')
        if isGraph:
            graph.show()
        else:
            drawNetworkx(graph)

    #to update the options based on previous options
    def update_next(*args):
        if option_network.get() == "SCSE":
            option_graph.set("Degree Distribution")
            dropdown_graph = OptionMenu(root, option_graph, *measures)
            dropdown_graph.place(x=100, y=95)
            option_graph2.set("Not Applicable")
            dropdown_graph2 = OptionMenu(root, option_graph2, "Not Applicable")
            dropdown_graph2.place(x=300, y=95)

            if option_factor.get() != "Not Applicable":
                option_factor.set("Not Applicable")
                dropdown_factor = OptionMenu(root, option_factor,
                                             "Not Applicable")
                dropdown_factor.place(x=100, y=55)
        elif option_network.get() == "Coauthor":
            option_graph.set("Degree Distribution")
            dropdown_graph = OptionMenu(root, option_graph, *measures1)
            dropdown_graph.place(x=100, y=95)
            option_graph2.set("Not Applicable")
            dropdown_graph2 = OptionMenu(root, option_graph2, "Not Applicable")
            dropdown_graph2.place(x=300, y=95)

            if option_factor.get() != "Not Applicable":
                option_factor.set("Not Applicable")
                dropdown_factor = OptionMenu(root, option_factor,
                                             "Not Applicable")
                dropdown_factor.place(x=100, y=55)

        elif option_network.get() == "Faculty Comparisons":
            option_factor.set("position")
            dropdown_factor = OptionMenu(root,
                                         option_factor,
                                         *factor,
                                         command=update)
            dropdown_factor.place(x=100, y=55)
            update()

    def update(*args):
        if option_factor.get() == "position":
            option_graph.set("Professor")
            dropdown_graph = OptionMenu(root, option_graph, *measures2)
            dropdown_graph.place(x=100, y=95)
            option_graph2.set("None")
            dropdown_graph2 = OptionMenu(root, option_graph2, *measures2)
            dropdown_graph2.place(x=300, y=95)

        elif option_factor.get() == "management":
            option_graph.set("Y")
            dropdown_graph = OptionMenu(root, option_graph, *measures3)
            dropdown_graph.place(x=100, y=95)
            option_graph2.set("None")
            dropdown_graph2 = OptionMenu(root, option_graph2, *measures3)
            dropdown_graph2.place(x=300, y=95)

        elif option_factor.get() == "area":
            option_graph.set("Data Management")
            dropdown_graph = OptionMenu(root, option_graph, *measures4)
            dropdown_graph.place(x=100, y=95)
            option_graph2.set("None")
            dropdown_graph2 = OptionMenu(root, option_graph2, *measures4)
            dropdown_graph2.place(x=300, y=95)

    #Labelling
    networkgraph_label = Label(root, text="Network: ")
    networkgraph_label.place(x=10, y=20)

    measures_label = Label(root, text="Graph/Findings: ")
    measures_label.place(x=10, y=100)

    factor_label = Label(root, text="Factor: ")
    factor_label.place(x=10, y=60)

    #options
    option_network = StringVar()
    option_graph = StringVar()
    option_factor = StringVar()
    option_graph2 = StringVar()

    #setting defaults
    option_network.set("SCSE")
    option_graph.set("Degree Distribution")
    option_factor.set("Not Applicable")
    option_graph2.set("Not Applicable")

    #options for networkgraphs
    network = ["SCSE", "Coauthor", "Faculty Comparisons"]

    #options for factors
    factor = ["position", "management", "area"]

    #options for questions, will be changed accordingly
    measures = [
        "Degree Distribution", "Publication Distribution",
        "Reputation Distribution", "Reputation Degree", "Maximum Degree Change"
    ]
    measures1 = ["Degree Distribution"]
    measures2 = [
        "None", "Professor", "Associate Professor", "Assistant Professor",
        "Lecturer"
    ]
    measures3 = ["Y", "N"]
    measures4 = [
        "Data Management", "Data Mining", "Information Retrieval",
        "Computer Vision", "AI/ML", "Computer Networks", "Cyber Security",
        "Software Engineering", "Computer Architecture", "HCI",
        "Distributed Systems", "Computer Graphics", "Bioinformatics",
        "Multimedia"
    ]

    #Displays network dropdown menu
    dropdown_network = OptionMenu(root,
                                  option_network,
                                  *network,
                                  command=update_next)
    dropdown_network.place(x=100, y=15)

    #Displayes question dropdown menu
    dropdown_graph = OptionMenu(root, option_graph, *measures)
    dropdown_graph.place(x=100, y=95)

    #Displays factor dropdown menu
    dropdown_factor = OptionMenu(root, option_factor, "Not Applicable")
    dropdown_factor.place(x=100, y=55)

    #Displays factor dropdown menu
    dropdown_graph2 = OptionMenu(root, option_graph2, "Not Applicable")
    dropdown_graph2.place(x=300, y=95)

    #Button to confirm and show, defined at the top
    btnConfirm = Button(root,
                        text="Show Graph/Findings",
                        command=lambda: show(btnConfirm))
    btnConfirm.place(x=180, y=180)

    root.mainloop()
Пример #11
0
import tkinter as Tk
from tkinter import *
import pyodbc as odbc
from pyodbc import *

golfers = Tk()
golfers.title("Golfers")
golfers.geometry('400x600')


# Databases

# Create a Database or Connect to one
conn = odbc.connect('Driver={SQL Server};'
                    'Server=DESKTOP-SCL1250\SQLEXPRESS01;'
                    'Database=tgt;'
                    'Trusted_Connection=yes;')
# Create Cursor
c = conn.cursor()



# # #Commit Changes
c.commit()
# Close Connection
c.close()

golfers.mainloop()
Пример #12
0
 def run(tk_root: tk):
     if tk_root is None:
         logging.error('tk instance is null')
         return
     tk_root.mainloop()
Пример #13
0
#!/bin/env python
import tkinter as Tk
from tkinter import *

about = Tk()
about.title("About termux-desktop")
about.geometry("320x200")

text = Label(about, text="""
Termux-desktop-xfce is an active project with
the aim of giving a unique look to termux x11
""")

text.pack()

mensaje = Label(about, text="Tank you for interest in termux-desktop-xfce!", fg="red")
mensaje.pack()

creador = Label(about, text=" - The Yisus Development Team", fg="green")
creador.pack()


about.mainloop()
Пример #14
0
    def __init__(self, url1, url2, url3, url4):

        window = Tk()
        window.title("Ping Indicator")



        frame = Frame(window)
        frame.pack()

        self.color = StringVar()

        self.canvas = Canvas(window, width=700, height=800, bg="white")
        self.canvas.pack()

        self.oval_one = self.canvas.create_oval(5, 50, 300, 300, fill="white")
        self.oval_two = self. canvas.create_oval(400, 50, 700, 300, fill='white')
        self.oval_three = self.canvas.create_oval(5, 400, 300, 650, fill="white")
        self.oval_four = self.canvas.create_oval(400, 400, 700, 650, fill='white')
        self.rectangle_one = self.canvas.create_rectangle(5, 5, 300, 40, fill="#001A57")
        self.rectanglefill_one = self.canvas.create_text(150, 20, fill="white", width=295,
                                                         text="Request Result: " + str(url1))
        self.rectangle_two = self.canvas.create_rectangle(400, 5, 700, 40, fill="#001A57")
        self.rectanglefill_two = self.canvas.create_text(550, 20, fill="white", width=295,
                                                         text="Request Result: " + str(url2))

        self.rectangle_three = self.canvas.create_rectangle(5, 335, 300, 370, fill="#001A57")
        self.rectanglefill_three = self.canvas.create_text(150, 350, fill="white", width=295,
                                                         text="Request Result: " + str(url3))
        self.rectangle_four = self.canvas.create_rectangle(405, 335, 700, 370, fill="#001A57")
        self.rectanglefill_four = self.canvas.create_text(550, 350, fill="white", width = 295,
                                                         text="Request Result: " + str(url4))
        # self.oval_green = self.canvas.create_oval(230, 10, 330, 110, fill="white")

        if (ping(url1) != 'False'):
            self.color.set('G')
            self.canvas.itemconfig(self.oval_one, fill="green")
            #window.title("The website returned the ping! :D")
        else:
            self.color.set('R')
            self.canvas.itemconfig(self.oval_one, fill='red')
            #window.title("The website did not return the ping :( ")
        if (ping(url2) != 'False'):
            self.color.set('G')
            self.canvas.itemconfig(self.oval_two, fill="green")
            #window.title("The website returned the ping! :D")
        else:
            self.color.set('R')
            self.canvas.itemconfig(self.oval_two, fill='red')
        if (ping(url3) != 'False'):
            self.color.set('G')
            self.canvas.itemconfig(self.oval_three, fill="green")
            # window.title("The website returned the ping! :D")
        else:
            self.color.set('R')
            self.canvas.itemconfig(self.oval_three, fill='red')
            # window.title("The website did not return the ping :( ")
        if (ping(url4) != 'False'):
            self.color.set('G')
            self.canvas.itemconfig(self.oval_four, fill="green")
            # window.title("The website returned the ping! :D")
        else:
            self.color.set('R')
            self.canvas.itemconfig(self.oval_four, fill='red')
            #window.title("The website did not return the ping :( ")
            # textbox = Text (window)

        # textbox.pack()


        window.mainloop()
Пример #15
0
Ventana.resizable(width=False, height=False)
Pestanas = ttk.Notebook(Ventana)
Pestanas.pack(fill="both",
              expand="yes")  #Las ventanas se van a expandir en toda la ventana

#Creando pestanas
Bienvenido = ttk.Frame(Pestanas)
Poi = ttk.Frame(Pestanas)
Bi = ttk.Frame(Pestanas)
Geome = ttk.Frame(Pestanas)
Hiper = ttk.Frame(Pestanas)
No = ttk.Frame(Pestanas)
NA = ttk.Frame(Pestanas)
Pestanas.add(Bienvenido, text="Bienvenido")
Pestanas.add(Poi, text="Poisson")
Pestanas.add(Bi, text="Binomial")
Pestanas.add(Geome, text="Geométrica")
Pestanas.add(Hiper, text="Hipergeométrica")
Pestanas.add(No, text="Normal")
Pestanas.add(NA, text="Sin Parámetros")

Welcome(Bienvenido)
Pois(Poi)
Bino(Bi)
Geo(Geome)
HiperGeo(Hiper)
Normalita(No)
NA_Para(NA)

Ventana.mainloop()
Пример #16
0
canvas.pack()

"""
p = PanedWindow(interface, orient=HORIZONTAL)
p.pack(side=TOP, expand=N, fill=BOTH, pady=20, padx=2)
p.add(canvas.pack())
p.add(Label(p, text='Projet de M1\nFreeDoM Tools\n2018-2019\n', background='white', anchor=CENTER,width=25) )
p.add(canvas.pack())
p.pack()
"""
menu1 = Menu(menubar, tearoff=0, font=("bold",10))
menu1.add_command(label="Sauvegarder", command=Enregistrer)
menu1.add_command(label="rien")
menu1.add_separator()
menu1.add_command(label="Quitter", command=interface.quit)
menubar.add_cascade(label="Fichier", menu=menu1)
interface.config(menu=menubar)

var_label = StringVar()

label = Label(interface, text="Projet de M1\nFreeDoM Tools\n2018-2019\n", font=("bold",10))
label.pack()

bouton=Button(interface, text="Parcourir",command = Parcourir, width="20", height="3",font=("bold",15),bg="#0d4fba", activebackground="#75b1ea", relief="flat")
bouton = bouton.pack()

label=Label(interface,textvariable=var_label, font=("bold",15), width="20", height="3").pack()
var_label.set(' ')

interface.mainloop()
Пример #17
0
    def intermediaire3D():
        root = Tk()
        root.config(bg="#DCDCDC")
        if var_langue == "francais":
            root.title("Options 3D")
        else:
            root.title("3D options")
        root.geometry("350x800")
        root.resizable(
            width=False,
            height=False)  # Redimensionnement de la fenêtre immobilisée.

        police_options3D = font.Font(
            root, size=12, weight='bold',
            family='Helvectica')  # Mise en place du style police.

        label1 = Label(root,
                       text="Sélection les numéros de boutons à afficher :",
                       font=police_options3D)
        label1.config(bg="#DCDCDC")
        label1.pack()

        f3 = Frame(root)
        s3 = Scrollbar(f3)
        l3 = Listbox(f3,
                     selectmode=MULTIPLE,
                     exportselection=0,
                     bg='#F9F9F8',
                     font=police_options3D)  # EXTENDED
        f5 = Frame(root)
        l5 = Listbox(f5,
                     selectmode=MULTIPLE,
                     exportselection=0,
                     bg='#F9F9F8',
                     font=police_options3D)  # EXTENDED
        if var_langue == "francais":
            l3.insert(0, 'Déselectionner')
        else:
            l3.insert(0, 'Deselect')
        l3.itemconfig(0, bg='#ff6666')

        if var_langue == "francais":
            for i in range(1, 40):
                l3.insert(i, 'Marqueur ' + str(i))
        else:
            for i in range(1, 40):
                l3.insert(i, 'Marker ' + str(i))
        s3.config(command=l3.yview)
        l3.config(yscrollcommand=s3.set)
        l3.pack(side=LEFT, fill=Y)
        s3.pack(side=RIGHT, fill=Y)
        f3.pack()

        def clic3(evt):
            items = l3.curselection()
            if 0 in items:
                l3.selection_clear(0, 40)
            global leger
            leger.extend(l3.curselection())
            return print(
                items)  # On retourne l'élément (un string) sélectionné

        def clicd3(evt):
            print(evt.y)  # recupere la coordonée selon y
            print(l3.nearest(evt.y))  # reecupere le bouton le plus proche
            print(evt)
            fr = l3.nearest(evt.y)
            # vou[fr][i][0]
            # s1 = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

            s2 = []
            s1 = []
            t = []
            fig = plt.figure()
            ax1 = fig.add_subplot(211)
            ax2 = fig.add_subplot(212, sharex=ax1)
            for i in range(len(vou[fr]) - 11550):
                s1.append(vou[fr][i][0])
                s2.append((vou[fr][i + 1][0] - vou[fr][i][0]) / 15)
                t.append(i)
                print('att')
                ax1.plot(t, s1)
                # ax2.plot(t, s2)
            del s1[i]
            ax2.plot(t, s2)
            # t=np.arange(59)

            multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1)
            pts = ginput(2)
            print(pts)
            x = math.floor(pts[0][0])
            x1 = math.floor(pts[1][0])
            y = str(s1[x])
            v = str(s2[x])
            y1 = str(s1[x1])
            v1 = str(s2[x1])
            ax1.text(0,
                     50,
                     r'y(t)=' + y,
                     fontsize=15,
                     bbox={
                         'facecolor': 'blue',
                         'alpha': 0.5,
                         'pad': 10
                     })
            ax2.text(0, 13, r'v(y)=' + v, fontsize=15)
            ax1.annotate('y(t)=' + y,
                         xy=(x, s1[x]),
                         xytext=(x + 1, s1[x] + 5),
                         arrowprops=dict(facecolor='black', shrink=0.05))
            ax2.annotate('v(y)=' + v,
                         xy=(x, s2[x]),
                         xytext=(x + 1, s2[x] + 5),
                         arrowprops=dict(facecolor='black', shrink=0.05))
            ax1.text(0,
                     50,
                     r'y(t)=' + y1,
                     fontsize=15,
                     bbox={
                         'facecolor': 'blue',
                         'alpha': 0.5,
                         'pad': 10
                     })
            ax2.text(0, 13, r'v(y)=' + v1, fontsize=15)
            ax1.annotate('y(t)=' + y1,
                         xy=(x1, s1[x1]),
                         xytext=(x1 + 1, s1[x1] + 5),
                         arrowprops=dict(facecolor='black', shrink=0.05))
            ax2.annotate('v(y)=' + v1,
                         xy=(x1, s2[x1]),
                         xytext=(x1 + 1, s2[x1] + 5),
                         arrowprops=dict(facecolor='black', shrink=0.05))
            plt.show()

        l3.bind(
            '<ButtonRelease-1>', clic3
        )  ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox
        l3.bind('<Double-Button-1>', clicd3)
        label2 = Label(root,
                       text="Sélection du style :",
                       font=police_options3D)
        label2.config(bg="#DCDCDC")
        label2.pack()
        f4 = Frame(root)
        s4 = Scrollbar(f4)
        l4 = Listbox(f4,
                     selectmode=MULTIPLE,
                     exportselection=0,
                     bg='#F9F9F8',
                     font=police_options3D)  # EXTENDED
        if var_langue == "francais":
            l4.insert(0, 'Déselectionner')
            l4.itemconfig(0, bg='#ff6666')
            l4.insert(1, 'Traits')
            l4.insert(2, 'Points')
            l4.insert(3, 'Relier')
            l4.insert(4, 'Effacer')
            l4.insert(5, 'Historique')
        else:
            l4.insert(0, 'Deselect')
            l4.itemconfig(0, bg='#ff6666')
            l4.insert(1, 'Lines')
            l4.insert(2, 'Dots')
            l4.insert(3, 'Link')
            l4.insert(4, 'Erase')
            l4.insert(5, 'History')
        s4.config(command=l3.yview)
        l4.config(yscrollcommand=s4.set)
        l4.pack(side=LEFT, fill=Y)
        s4.pack(side=RIGHT, fill=Y)
        f4.pack()

        def clic4(evt):
            items = l4.curselection()
            if 0 in items:
                l4.selection_clear(0, 4)
            if 1 in items:
                l4.selection_clear(3)
            if 3 in items:
                l4.selection_clear(1)
                '''#animate(i)'''

            fonction3D(fenetreResultat, chemin, l4.curselection(), [], [])
            if (3 in items) == False:
                l4.selection_clear(4)
            if 4 in items:
                global lourd
                lourd = []
            return print(
                items)  ## On retourne l'élément (un string) sélectionné

            fonction3D(fenetreResultat, chemin, l4.curselection(), [], [])

        l4.bind(
            '<ButtonRelease-1>', clic4
        )  ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox

        label3 = Label(root,
                       text="Points à afficher (tous par défaut):",
                       font=police_options3D)
        label3.config(bg="#DCDCDC")
        label3.pack()
        s5 = Scrollbar(f5)

        if var_langue == "francais":
            l5.insert(0, 'Déselectionner')
        else:
            l5.insert(0, "Deselect")
        l5.itemconfig(0, bg='#ff6666')
        if var_langue == "francais":
            for i in range(1, 40):
                l5.insert(i, 'Marqueur ' + str(i))
        else:
            for i in range(1, 40):
                l5.insert(i, 'Marker ' + str(i))
        s5.config(command=l5.yview)
        l5.config(yscrollcommand=s5.set)
        l5.pack(side=LEFT, fill=Y)
        s5.pack(side=RIGHT, fill=Y)
        f5.pack()

        def clic5(evt):
            itemos = l5.curselection()
            if len(itemos) > 2:
                l5.selection_clear(itemos[0])
                print(len(itemos))
            if len(itemos) == 2:
                global lourd
                lourd.append(l5.curselection())
            if 0 in itemos:
                l5.selection_clear(0, 40)
            return print(
                itemos)  ## On retourne l'élément (un string) sélectionné

        l5.bind(
            '<ButtonRelease-1>', clic5
        )  ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox

        if var_langue == "anglais":
            label1["text"] = "Select the number of buttons to display :"
            label2["text"] = "Select the style :"
            label3["text"] = "Dots to display (all by default) :"

        root.mainloop()
Пример #18
0
    def quiz():
        mat = Tk()
        mat.geometry("800x400")
        mat.title("Math Quiz")
        global score, count
        score = 0
        count = 0

        def ask_question():
            # get globals
            qq = get_questions("english.json")
            # retrive questions from json parcer with inputed json files
            eh1 = Label(mat, text="Question " + str(count + 1), font="40")
            eh1.pack()
            score_readout = Label(mat,
                                  text="Score: " + str(score) + "/" +
                                  str(count),
                                  font="25")
            score_readout.pack()
            question_label = Label(mat, text=qq[4], font="30")
            question_label.pack()

            def correct():
                global score, count
                mixer.init(22050, -8, 4, 65536)
                mixer.music.load('rr.ogg')
                mixer.music.play(0)
                score = score + 1
                count = count + 1
                unpack_all()
                if count <= 11:
                    ask_question()
                else:
                    end_score = str(score) + " / " + str(10)
                    messagebox.showinfo("Score",
                                        "Your Score Was: %s" % end_score)
                    mat.destroy()

            def incorrect():
                global count, score
                mixer.init(22050, -8, 4, 65536)
                mixer.music.load('ww.ogg')
                mixer.music.play(0)
                count = count + 1
                unpack_all()
                if count < 10:
                    ask_question()
                else:
                    end_score = str(score) + "/" + str(count)
                    score = 0
                    count = 0
                    messagebox.showinfo(
                        "Score", "Your Score Was: %s" % score + " Out of 12")
                    mat.destroy()

            def unpack_all():
                for mat_b in bttns:
                    mat_b.pack_forget()
                score_readout.pack_forget()
                eh1.pack_forget()
                question_label.pack_forget()

            mat_b1 = Button(mat, text=qq[0], command=correct)
            mat_b2 = Button(mat, text=qq[1], command=incorrect)
            mat_b3 = Button(mat, text=qq[2], command=incorrect)
            mat_b4 = Button(mat, text=qq[3], command=incorrect)
            bttns = [mat_b1, mat_b2, mat_b3, mat_b4]
            shuffle(bttns)
            for mat_ in bttns:
                mat_.pack()

        ask_question()
        mat.mainloop()
                score += m
            print(TransfoListeChaine(MotAffiche))
            print("Nombre de vies restantes : " + str(chances))
        else:
            print("La lettre choisie a déjà été demandée")
            print(TransfoListeChaine(MotAffiche))


NewFenetre = Tk()
NewFenetre.title('Le Pendu')
NewFenetre.geometry('400x400+400+400')
BoutonLancer = Button(NewFenetre,
                      text='Jouer',
                      command=lambda: Afficher_(MotRandom()))
BoutonLancer.pack(side=LEFT, padx=4, pady=4)
NewFenetre.mainloop()

BoutonInstruction = Button(NewFenetre, text='Instructions', command=Regle)
BoutonInstruction.pack(side=LEFT, padx=4, pady=4)
BoutonQuitter = Button(NewFenetre, text='Quitter', command=NewFenetre.destroy)
BoutonQuitter.pack(side=LEFT, padx=4, pady=4)

BoutonRejouer = Button(NewFenetre, text='Rejouer', command=Regle)
BoutonRejouer.pack(side=LEFT, padx=4, pady=4)

NewFenetre.mainloop()

Frame1 = Frame(NewFenetre, relief=GROOVE)
Frame1.pack(side=LEFT, padx=40, pady=40)

NewFenetre = Tk()
Пример #20
0
class WCUI:
    window = ""

    Sc_height = 0
    Sc_width = 0

    def __init__(self):
        self.window = Tk()
        self.window.title("Web Customizer")
        self.window.geometry('800x800')
        self.window.config(bg="white")
        self.window.overrideredirect(False)

        self.Sc_height = self.window.winfo_screenheight() // 2
        self.Sc_width = self.window.winfo_screenwidth() // 2

        self.window.geometry(f"{self.Sc_width}x{self.Sc_height}")
        print(self.Sc_height)
        self.nlpObject = Nlp()
        self.htmlObject = html_writer()

    def makeChanges(self, changes):
        if (len(changes) >= 3 and not (changes == None)
                and not (changes == "")):
            print(changes)
            self.nlpObject.proccessInput(changes)

    def resetpage(self):
        self.htmlObject.file_writer()

    def clearEntry(self, inputText):
        self.inputText.delete(0.0, 23.0)

    def mainmenu(self):
        myFont = font.Font(size=15)

        self.inputText = Text(self.window,
                              height=self.Sc_height,
                              width=self.Sc_width,
                              bg="black",
                              fg="white",
                              insertbackground='white')
        self.inputText['font'] = myFont
        self.inputText.insert(0.0, 'Type changes need here ...')
        self.inputText.bind("<Button-1>", self.clearEntry)
        self.inputText.place(relx=0, rely=0)

        resetbutton = Button(self.window,
                             text="Reset Webpage",
                             width=400,
                             bg="yellow",
                             fg="black",
                             command=lambda: self.resetpage())
        resetbutton['font'] = myFont
        resetbutton.pack(side=BOTTOM)

        button = Button(self.window,
                        text="Apply Changes",
                        width=500,
                        bg="blue",
                        fg="white",
                        command=lambda: self.makeChanges(
                            self.inputText.get("1.0", "end-1c")))
        button['font'] = myFont
        button.pack(side=BOTTOM)
        self.window.mainloop()
Пример #21
0
import tkinter as Tk
import sqlite3 as SQL

order_form = Tk()
SQL.connect('')

order_form.mainloop()
Пример #22
0
canvas = Canvas(master, width=w, height=h)
canvas.pack()
tabControl = ttk.Notebook(master)

tab1 = ttk.Frame(tabControl)  #making a frame
tabControl.add(tab1, text='Main Screen')  #properties of the fram
tab2 = ttk.Frame(tabControl)
tabControl.add(tab2, text='Advanced')

tabControl.pack(expand=1, fill='both')

run_count = 0


def push_button():
    global run_count  #need this to have a counter
    run_motor()
    run_count += 1
    print("done run " +
          str(run_count))  #make sure the value is in string format


b = Button(tab1, text="Run Motor", command=push_button)
b.pack()

c = Button(tab2, text="Run Valve", command=push_button)
c.pack()

canvas.configure(background='black')
master.mainloop()
Пример #23
0
load = Button(main, text ='Load VCF', font = "Helevtica 16 bold", cursor="circle",command = open_vcf, bg = orangedark, fg = "white", bd = 0.2 , pady = 4, padx = 5)
label2 = Label(main, bg=bluedark, font = "helevtica 10 italic")
label = Label(main, text="Welcome on Kofi.dev", bg = blue, font = "helevtica 10 italic") 

#PLacement de l'interface
back.place(rely = 0.4, relx = 0.4 , height = 300, width = 300 )    
#back2.place(rely = 0.4, relx = 0.4 , height = 200, width = 200 ) 
load.place(rely = 0.4, relx = 0.4 , height = 150, width = 150 )
#Entête du programme
label2.place(relheight = 0.05,relwidth = 1,rely = 0)
label.place(relwidth = 1, rely = 0  )

# Création d'un menu sur la fenêtre

menubar = Menu(main)
menu1 = Menu(menubar, tearoff=0)
menu1.add_command(label="About kofi", command = openweb)
menu1.add_command(label="User guide", command = openweb2)
menubar.add_cascade(label="Help", menu=menu1)

#Attribution du menu au main
main.config(menu=menubar)

# Placement de l'horloge
clock = Label(main, font=('times', 20, 'bold'), bg='white', fg= bluedark)
clock.place(rely = 0.85, relx = 0.85)
hour()


main.mainloop()
Пример #24
0
'''
print(north_avg)
print(east_avg)
print(south_avg)
print(west_avg)

mars_horizon = Image.fromarray(horizon)
plt.imshow(mars_horizon)
plt.show()
'''

print("score:")
print(mountain_score)

total_score = mountain_score + s
if total_score > 7:
    mixer.music.play()
    goodplace = cv2.imread('ogoodplace.jpg')
    plt.imshow(cv2.cvtColor(goodplace, cv2.COLOR_BGR2RGB))
    plt.show()
else:
    nogoodplace = cv2.imread('nogoodplace.jpg')
    plt.imshow(cv2.cvtColor(nogoodplace, cv2.COLOR_BGR2RGB))
    plt.show()

win.mainloop()

#os.system("pause")

# In[ ]:
Пример #25
0
tkinter.Entry(top, textvariable="time", width=40, bg="white").grid(row=8,
                                                                   column=2,
                                                                   sticky=E)

tkinter.Label(top, text="Purpose", bg="powderblue", fg="black").grid(row=9,
                                                                     column=1,
                                                                     sticky=E)
purpose = StringVar()
tkinter.Entry(top, textvariable="purpose", width=40, bg="white").grid(row=9,
                                                                      column=2,
                                                                      sticky=E)

tkinter.Button(top, text="Save/Print").grid(row=10, column=1, sticky=E)
tkinter.Button(top, text="Clear").grid(row=10, column=2, sticky=E)

cap = Button(top, text="capture").grid(row=11, column=4, sticky=E)
img1 = tkinter.PhotoImage(
    file="C:\\Users\\cadd\\Contacts\\Desktop\\download.png")
Label(top,
      image=img1,
      height="145",
      width="125",
      borderwidth=2,
      relief='solid').grid(row=3, rows=5, column=4, columns=1, sticky=E)

# In[55]:

top.mainloop()

# In[ ]:
Пример #26
0
def Create():
    
    root=Tk()
    root.geometry("700x500")
    f2=Frame(root)
    f3=Frame(root)
    
    def menu1():

        class Admin(Frame):
         
            def __init__(self, parent):
                self.parent=parent
                self.initialize_user_interface()
            def create(self):
                global i
                i=1
                self.tree.delete(*self.tree.get_children())
                cursor.execute("select * from movie")
                results = cursor.fetchall()
                for row in results:
                    x = row[0]
                    y=row[1]
                    z=row[2]
                    valuelist = [y,z,x]
                    i=i+1
                    self.tree.insert('', 'end',values=(valuelist), tags='cold',text=x)

                

            def initialize_user_interface(self):
                global selected
                global selected2
                global selected3
                self.parent.grid_rowconfigure(0,weight=1)
                self.parent.grid_columnconfigure(0,weight=1)
                self.parent.config(background="lavender")
                self.dose_label =Label(self.parent ,text = "Movie Name")
                self.dose_entry = Entry(self.parent)
                self.dose_label.place(x=50,y=10)
                self.dose_entry.place(x=250,y=10)
                self.dose_label2 =Label(self.parent ,text = "Date",width=20)
                self.dose_label2.place(x=50,y=40)
                options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"]
                selected = StringVar(value="Year")
                op=OptionMenu(self.parent, selected, *(options))
                op.place(x=250,y=40)
                options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"]
                selected2 = StringVar(value="Month")
                op2 = OptionMenu(self.parent, selected2, *(options2))
                op2.place(x=320,y=40)
                op2.config(width=5)
                options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']
                selected3 = StringVar(value="Date")
                op3 = OptionMenu(self.parent, selected3, *(options3))
                op3.place(x=400,y=40)
                self.submit_button = Button(self.parent, text = "Insert", bd=4,command = self.insert_data)
                self.submit_button.place(x=250,y=100)
                self.b=Button(self.parent, fg='blue',text="Update",bd=4,command=up1).place(x=300,y=100)
               

            # Set the treeview
                self.tree = ttk.Treeview( self.parent, columns=('Movie', 'date'))
                self.tree.heading('#0', text='ID')
                self.tree.heading('#1', text='movie')
                self.tree.heading('#2', text='Date')
                self.tree.column('#1', stretch=YES)
                self.tree.column('#2', stretch=YES)
                self.tree.column('#0', stretch=YES)
                self.tree.place(x=10,y=130)
                self.treeview = self.tree
                self.create()
            # Initialize the counter
                self.i = 0
            def insert_data(self):
                self.treeview.insert('', 'end', text=""+str(i), values=(self.dose_entry.get(),str(selected.get()+"-"+selected2.get()+"-"+selected3.get())))
                a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get())
                b=self.dose_entry.get()
                cursor.execute("""INSERT INTO movie VALUES (%d,'%s','%s')"""%(i,b,a))
                row= cursor.fetchone()
                conn.commit()
            def retur(self):
                a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get())
                b=self.dose_entry.get()
                l=list(a,b)
                return(l)



      


        def main():
            f2.pack(fill=BOTH, expand=1)
            d=Admin(f2)
            root.mainloop()

        if __name__=="__main__":
            main()
    def menu4():
        c.delete("all")
        c.create_rectangle(200,25,700,150,fill="Red")
        label1.config(text="It is a rectangle ")

    def  det():
        top=Tk()
        dose_label =Label(top ,text = "Movie Name")
        dose_entry = Entry(top)
        dose_label.place(x=0,y=10)
        dose_entry.place(x=90,y=10)
        modified_label = Label(top, text = "ID ")
        modified_entry =Entry(top)
        modified_label.place(x=0,y=60)
        modified_entry.place(x=90,y=60)
        b3=Button(top, fg='blue',text="Delete",bd=4).place(x=30,y=90)
         

        
    def  up1(*args):
        def  up12():    
            cursor.execute("update movie set movie_nm='%s' , movie_date='%s' where movie_id=%d"%(b,a,int(modified_entry.get())))
            row= cursor.fetchone()
        dose_label =Label(root,text = "Movie Name")
        dose_entry = Entry(root)
        dose_label.place(x=50,y=10)
        dose_entry.place(x=250,y=10)
        dose_label2 =Label(root ,text = "Date",width=20)
        dose_label2.place(x=50,y=40)
        options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"]
        selected = StringVar(value="Year")
        op=OptionMenu(root, selected, *(options))
        op.place(x=250,y=40)
        options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"]
        selected2 = StringVar(value="Month")
        op2 = OptionMenu(root, selected2, *(options2))
        op2.place(x=320,y=40)
        op2.config(width=5)
        options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']
        selected3 = StringVar(value="Date")
        op3 = OptionMenu(root, selected3, *(options3))
        op3.place(x=400,y=40)
        b2=Button(root ,fg='blue',text="   DATE  ",bd=4,command=up12).place(x=300,y=100)
        modified_label = Label(root, text = "ID ")
        modified_entry =Entry(root)
        modified_label.place(x=50,y=80)
        modified_entry.place(x=250,y=80)
        a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get())
        b=dose_entry.get()
        
         
    def  user():

        class user_det(Frame):

            def create(self):
                a=[]

                self.tree.delete(*self.tree.get_children())
                cursor.execute("select ID from user")
                results = cursor.fetchall()
                cursor.execute("select usr_ID from user_mov")
                row = cursor.fetchall()
                k=0
                for i in results:
                    if i in row:
                        a.append(1)
                    else:
                        a.append(0)
                for i in range(len(a)):
                    w=i+1
                    cursor.execute("select user_nm from user where ID=%d"%w)
                    rp = cursor.fetchone()
                    if a[i]==1:
                        z=i+1
                        cursor.execute("select movie_id,thea_nm from user_mov where usr_ID=%d"%z)
                        results = cursor.fetchone()
                        r=results[0]
                        cursor.execute("select movie_dt from movie where movie_id=%d"%r)
                        rk = cursor.fetchone()
                        p=results[1]
                        cursor.execute("select movie_nm from movie where movie_id=%d"%(int(r)))
                        x= cursor.fetchone()
                        self.tree.insert('', 'end', text="", values=(rp,x,rk,p))
                    else:
                        
                        self.tree.insert('', 'end', text="", values=(rp,'NOT BOOK','NOT BOOK','NOT BOOK'))
                        
          
         
            def __init__(self, parent):
                self.parent=parent
                self.initialize_user_interface()

            def initialize_user_interface(self):
                
                self.parent.grid_rowconfigure(0,weight=1)
                self.parent.grid_columnconfigure(0,weight=1)
                self.parent.config(background="lavender")
                win2 = Toplevel()
                new_element_header=['1st','2nd','3rd','4th']
                treeScroll = ttk.Scrollbar(win2)
                treeScroll.pack(side=RIGHT, fill=Y)
                self.tree = ttk.Treeview(win2,columns=new_element_header, show="headings", yscrollcommand = treeScroll)
                self.tree.heading('#0', text='Item')
                self.tree.heading('#1', text='User name')
                self.tree.heading('#2', text='Movie')
                self.tree.heading('#3', text='Date')
                self.tree.heading('#4', text='Theater')
                self.create()


                self.tree.pack(side=LEFT, fill=BOTH)
               

       
            # Initialize the counter
                self.i = 0
            def insert_data(self):
                
                self.treeview.insert('', 'end', text="Item_"+str(self.i), values=(self.dose_entry.get()+" mg", self.modified_entry.get()))
                self.i = self.i + 1


      


        def main():
            root.geometry("500x500")
            
           
            f3.pack(fill=BOTH, expand=1)
            d= user_det(f3)
            root.mainloop()

        if __name__=="__main__":
            main()
        

        
    def log():
        root.destroy()


    menubar=Menu(root)
    menubar=Menu(root)
    filename1=Menu(menubar)
    filename2=Menu(menubar)
    filename1.add_command(label="INSERT",command=menu1)
    filename1.add_command(label="Delete",command=det)
    filename2.add_command(label="SHOW USER",command=user)

    menubar.add_cascade(label="MOVIE",menu=filename1)
    menubar.add_cascade(label="USER",menu=filename2)
    menubar.add_cascade(label="LOGOUT",command=log)
    root.config(menu=menubar)
    root.mainloop()
    root.mainloop()
Пример #27
0
button = Checkbutton(frame,
                     text='Change Label',
                     variable=status,
                     fg='blue',
                     command=change_label)
lb = Label(root, textvariable=text)
button.pack(side=RIGHT)
lb.pack()
redbutton = Checkbutton(frame,
                        text='Exit',
                        highlightbackground='red',
                        fg='red',
                        command=sys.exit)
redbutton.pack(side=RIGHT)

root.mainloop()

#4. Write a python program using tkinter interface to take input in GUI program and print it

import tkinter as tk
from tkinter import ttk

master = tk.Tk()
lbl = ttk.Label(master, text='enter the name').grid(row=0, column=0)


def click():
    print("Hi," + name.get())
    tk.Label(master, text=name.get()).grid(row=2, column=0)

Пример #28
0
# Create Text Box Labels
event_id_label = Label(events, text="Event ID")
event_id_label.grid(row=1, column=0, padx=20)
event_type_label = Label(events, text="Event Type")
event_type_label.grid(row=2, column=0, padx=20)
event_name_label = Label(events, text="Event Name")
event_name_label.grid(row=3, column=0, padx=20)
event_winner_label = Label(events, text="Event Winner")
event_winner_label.grid(row=4, column=0, padx=20)
purse_label = Label(events, text="Purse")
purse_label.grid(row=5, column=0, padx=20)
_first_label = Label(events, text="Winner $")
_first_label.grid(row=6, column = 0, padx=20)
_second_label = Label(events, text="Second $")
_second_label.grid(row=7, column = 0, padx=20)
_third_label = Label(events, text='Third $')
_third_label.grid(row=8, column=0, padx=20)
_fourth_to_tenth_label = Label(events, text='Fourth to Tenth $')
_fourth_to_tenth_label.grid(row=9, column=0, padx=20)

# Create Buttons



# # #Commit Changes
c.commit()
# Close Connection
c.close()

events.mainloop()
Пример #29
0
import tkinter as Tk
from tkinter import *
from tkinter import ttk

window = Tk()
canvas = Canvas(window)
canvas.pack()


@staticmethod
def show():
    l = Label(window, text=e.get())
    l.place(x=30, y=30)
    l.pack()


e = Entry(window)
e.insert(12, "123")
e.pack(side='left')
e.bind('<Return>', show)

window.mainloop()
Пример #30
0
    def quiz():
        mat = Tk()
        global count, score
        score = 0
        count = 0
        mat.geometry("800x400")
        mat.title("English Quiz")
        mat.configure(background="yellow")

        def ask_question():
            global score, count
            # get globals
            qq = get_questions("english.json")
            score_readout = Label(mat,
                                  text="Score: " + str(score) + "/" +
                                  str(count),
                                  font=(None, 15),
                                  fg="blue",
                                  bg="yellow")
            score_readout.pack(side="top", anchor="w")
            # retrive questions from json parcer with inputed json files
            eh1 = Label(mat,
                        text="Question " + str(count + 1),
                        font=(None, 15),
                        fg="blue",
                        bg="yellow")
            eh1.pack(side="top", anchor="e")

            spacing_label = Label(mat,
                                  text="",
                                  font=(None, 15),
                                  fg="blue",
                                  bg="yellow")
            spacing_label.pack()

            question_label = Label(mat,
                                   text=qq[4],
                                   font=(None, 10),
                                   fg="blue",
                                   bg="yellow",
                                   wraplength=750)
            question_label.pack(side="top", anchor="w")

            def correct():
                global score, count
                mixer.init(22050, -8, 4, 65536)
                mixer.music.load('rr.ogg')
                mixer.music.play(0)
                score = score + 1
                count = count + 1
                unpack_all()
                if count < 10:
                    ask_question()
                else:
                    end_score = str(score) + " / " + str(10)
                    messagebox.showinfo(
                        "Score", "Your Score Was: %s" % score + " Out of 10")
                    mat.destroy()

            def incorrect():
                global count, score
                mixer.init(22050, -8, 4, 65536)
                mixer.music.load('ww.ogg')
                mixer.music.play(0)
                count = count + 1
                unpack_all()
                if count < 10:
                    ask_question()
                else:
                    # end_score = str(score)+"/"+"10"
                    mat.destroy()
                    messagebox.showinfo(
                        "Score", "Your Score Was: %s" % score + " Out of 10")
                    mat.destroy()
                    score = 0
                    count = 0
                    # end_score = 0

            spacing_label2 = Label(mat, text="", bg='yellow')
            spacing_label2.pack()

            def unpack_all():
                for mat_b in bttns:
                    mat_b.pack_forget()
                score_readout.pack_forget()
                eh1.pack_forget()
                question_label.pack_forget()
                spacing_label.pack_forget()
                spacing_label2.pack_forget()

            mat_b1 = Button(mat,
                            text=qq[0],
                            command=correct,
                            font=(None, 12),
                            width=80,
                            bg='gold',
                            fg='blue')
            mat_b2 = Button(mat,
                            text=qq[1],
                            command=incorrect,
                            font=(None, 12),
                            width=80,
                            bg='gold',
                            fg='blue')
            mat_b3 = Button(mat,
                            text=qq[2],
                            command=incorrect,
                            font=(None, 12),
                            width=80,
                            bg='gold',
                            fg='blue')
            mat_b4 = Button(mat,
                            text=qq[3],
                            command=incorrect,
                            font=(None, 12),
                            width=80,
                            bg='gold',
                            fg='blue')
            bttns = [mat_b1, mat_b2, mat_b3, mat_b4]
            shuffle(bttns)
            for mat_ in bttns:
                mat_.pack(side="top", anchor="w")

        ask_question()
        mat.mainloop()