def imageFinder(self):
        root = Tk()
        print('Ran imageFinder')
        latestFile = max(glob.glob('/home/pi/spibox/capture/primout/*'),
                         key=os.path.getctime)

        if latestFile == '/home/pi/spibox/capture/primout/primitive_output100.png':
            self.img2 = PhotoImage(
                file='/home/pi/spibox/capture/primout/primitive_output100.png')
            self.img2Label = Label(image=self.img2,
                                   bg="Black",
                                   width=256,
                                   height=256)
            self.img2Label.grid(row="3")
            root.after(5000, root.quit())
            print('Image updating done')

        else:
            self.img2 = PhotoImage(file=latestFile)
            self.img2Label = Label(image=self.img2,
                                   bg="Black",
                                   width=256,
                                   height=256)
            self.img2Label.grid(row="3")
            root.after(1000, self.imageFinder)
Beispiel #2
0
    def __init__(self):

        self.master = Tk()
        self.param = self.master.StringVar()
        self.param1 = TK.StringVar()
        self.param2 = TK.StringVar()
        self.param3 = TK.StringVar()
        self.param4 = Tk.StringVar()
        self.param5 = TK.StringVar()
        self.param6 = TK.StringVar()

        self.master.title("友邻港自动测试")
        filename = "history.txt"
        if not os.path.exists(filename):
            f = open("history.txt", "w")
            f.close()
        a_dict = {}
        f = open("history.txt", "r")
        str_line = f.readlines()
        for s in str_line:
            li = s.split("=")
            a_dict[li[0]] = ''.join(li[1]).strip('\n')
        f.close()
        print str_line
        self.a_dict = a_dict
def button_text(event, msg, x, y, w, h, color, display_surface, pic):
    global target
    global flagrun
    global arrived_robot
    display_surface.blit(pic, (0, 0))  # paint to screen
    pygame.draw.rect(display_surface, color, (x, y, w, h))
    # in area
    if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
        if x + w > event.pos[0] > x and y + h > event.pos[1] > y:
            #print(msg)
            target = msg
            Tk().wm_withdraw()  #to hide the main window
            MsgBox = tkMessageBox.askyesno(
                'Direction dialog',
                'Are you sure you want to go to room ' + msg + ' ?')
            print(MsgBox)
            if MsgBox == TRUE:
                tkMessageBox.showinfo('Direction', 'Navigation to room ' + msg)
                pub.publish(target)  ### SEND CANCEL DATA
                print('published : ' + str(target))
                flagrun = 0
            else:
                tkMessageBox.showinfo(
                    'Return', 'You will now return to the application screen')
                #time.sleep(5)
                #arrived_robot == 'arrvied'
                flagrun = 1

    smallText = pygame.font.SysFont("comicsansms", 30)
    textSurf, textRect = text_objects(msg, smallText)
    textRect.center = ((x + (w / 2)), (y + (h / 2)))
    display_surface.blit(textSurf, textRect)
Beispiel #4
0
def Creditos():
    Ventana1 = Tk()
    Ventana1.title("Créditos")
    Ventana1.geometry("500x200")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/proteco.png")
    im = im.resize((100, 100), Image.ANTIALIAS)
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=20, y=20)
    MARIO = Label(Ventana1, text="Mario Alberto Vásquez Cancino ").place(x=140,
                                                                         y=35)
    MARIO1 = Label(Ventana1, text="Becario PROTECO Generación 37").place(x=160,
                                                                         y=55)
    MARIO2 = Label(Ventana1,
                   text="Unánse al programa está super padre :)").place(x=140,
                                                                        y=75)
    PROTECO = Label(Ventana1, text="Info en Facebook: Proteco").place(x=160,
                                                                      y=95)

    RAUL = Label(
        Ventana1,
        text="Agradecimientos especiales a Raul E. Lopez Briega:").place(x=20,
                                                                         y=140)
    RAUL1 = Label(
        Ventana1,
        text="-Por tan buen blog, base para poder realizar este programa."
    ).place(x=40, y=160)
    Ventana1.mainloop()
Beispiel #5
0
def InfoNor():
    Ventana1 = Tk()
    Ventana1.title("Distribución Normal")
    Ventana1.geometry("965x290")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/nor.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Ventana1.mainloop()
Beispiel #6
0
def InfoHiper():
    Ventana1 = Tk()
    Ventana1.title("Distribución Hipergeométrica")
    Ventana1.geometry("985x535")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/hiper.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Ventana1.mainloop()
Beispiel #7
0
def InfoPoi():
    Ventana1 = Tk()
    Ventana1.title("Distribución Poisson")
    Ventana1.geometry("980x400")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/poi.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Ventana1.mainloop()
Beispiel #8
0
def InfoUni():
    Ventana1 = Tk()
    Ventana1.title("Distribución Uniforme")
    Ventana1.geometry("730x445")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/uni.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Uniforme()
    Ventana1.mainloop()
Beispiel #9
0
def InfoBer():
    Ventana1 = Tk()
    Ventana1.title("Distribución Bernoulli")
    Ventana1.geometry("964x345")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/ber.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Bernoulli()
    Ventana1.mainloop()
Beispiel #10
0
def InfoExp():
    Ventana1 = Tk()
    Ventana1.title("Distribución Exponencial")
    Ventana1.geometry("960x284")
    Ventana1.resizable(width=False, height=False)
    im = Image.open("Info/exp.png")
    ph = ImageTk.PhotoImage(im, master=Ventana1)
    label = Label(Ventana1, image=ph).place(x=0, y=0)
    Exponencial()
    Ventana1.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()
Beispiel #12
0
 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)
Beispiel #13
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()
Beispiel #14
0
def MasterFunction():

    MasterWindow = Tk()
    MasterWindow.title("Self Destruct")
    MasterWindow.geometry("1920x1080")

    def UserName():

        global StoredName
        Canvas(MasterWindow, width=1920, height=1080, bg="snow").place(x=0,
                                                                       y=0)
        StoredName = StringVar()
        NameLabel = Label(text="Please enter your name", bg="snow", font=font2)
        NameLabel.pack()
        NameEntryBox = Entry(bd=4,
                             textvariable=StoredName,
                             bg="snow",
                             font=font2)
        NameEntryBox.pack()
        ButtonName = Button(text="Continue",
                            font=font2,
                            bg="snow",
                            command=ChangeThis)
        ButtonName.pack()

    def ChangeThis():

        label1 = Label(text=StoredName, bg="snow", font=font2)
        label1.pack()

    def Menu():  #The first window the user sees.

        Canvas(width=1920, height=1080, bg="snow").place(x=0, y=0)
        TitleMain = Label(MasterWindow,
                          text="Self Destruct",
                          font=font1,
                          fg="deep sky blue",
                          bg="snow").place(x=845, y=1)
        ButtonStart = Button(MasterWindow,
                             text="Start",
                             font=font2,
                             fg="deep sky blue",
                             bg="snow",
                             command=UserName).place(x=909, y=60)
        ButtonExit = Button(MasterWindow,
                            text="Exit",
                            font=font2,
                            fg="deep sky blue",
                            bg="snow",
                            command=exit).place(x=915, y=130)

    Menu()
Beispiel #15
0
	def __init__(self):
		Window1 = Tk()
		
		 		
		button1 = Button(Window1, text = "See Animation", command = loadImage)
		button1.pack()		
	##	button2 = Button(Window1, text = "See Entry", command = loadWindow)
	##	button2.pack()
		listbox = Listbox(Window1)
		listbox.pack()
		listbox.insert(END, "List of Towns")
		##StartTown1 = myWin.getTown(StartTown)
		listbox.insert(END, StartTown)
Beispiel #16
0
def TkDemo():  # Finally, set up <root> & start UI
    """ HELP:       Tk-GUI-MVC via a Class
        TESTS:      TkDemo()
        """
    root = Tk()
    root.title('TSLA/AAPL')

    root.lift()

    app = UiSuperFrame(root)

    app.mainloop()
    pass
Beispiel #17
0
class formwindow_iniciarSesion:
    ventana = Tk()
    ventana.title("Iniciar sesion")
    ventana.geometry("325x200")
    usernameLABEL = Label(ventana, text="Nombre de usuario:").place(x=10,y=10)
    usernameENTRY = Entry(ventana, bg = "white", width = 20).place(x=10,y=30)
    passwordLABEL = Label(ventana, text="Clave:").place(x=10,y=60)
    passwordENTRY = Entry(ventana, bg = "white", width = 20, show = "*").place(x=10,y=80)
    serverLABEL = Label(ventana, text="Servidor:").place(x=10,y=110)
    serverENTRY = Entry(ventana, bg = "white", width = 15).place(x=10,y=130)
    portLABEL = Label(ventana,text="Puerto:").place(x=140,y=130)
    portENTRY = Entry(ventana, bg = "white", width = 15).place(x = 185,y = 130)
    loginBUTTON = Button(ventana, text="Iniciar Sesion").place(x=10,y=170)
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()
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()
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()
Beispiel #21
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()
Beispiel #22
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()
Beispiel #23
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()
Beispiel #24
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()
Beispiel #25
0
class DisplayFrame:
    
    root = Tk()
    
    def _init_(self, master, queue):
        self.queue = queue
        Frame._init_(self)
        #w, h = 700, 700
        self.grid()
    
    def displayPicture(self):
        print('Building display frame')
        
        self.img1 = PhotoImage(file = '/home/pi/spibox/capture/spi_output_1.png')
        self.img1Label = Label(image = self.img1, width = 256, height = 256)
        self.img1Label.grid(row = "1")
        #Top image, doesn't change
        
        self.text = Text(fg = "White", bg = "Red", bd = 5, width = 35, height = 1)
        self.text.insert(INSERT, "Maryville Cyber Fusion Center")
        self.text.tag_configure("center", justify = "center")
        self.text.tag_add("center", 1.0, "end")
        self.text.grid(row = "2")
        #Middle banner with text
        
        self.img2 = PhotoImage(file = '/home/pi/spibox/capture/loading.png')
        self.img2Label = Label(image = self.img2, bg = "Black", width = 256, height = 256)
        self.img2Label.grid(row = "3")
        #Bottom image
        
        main()
        q.put(watcherTread())
        
        DisplayFrame.root.mainloop()
        print("after starting tkinter main loop")
    
    
    def updateImage(self):
        print("Bottom image should update")
        
        fileList = glob.glob('/home/pi/spibox/capture/primout/*')
        latestFile = max(fileList, key = os.path.getctime)
        print(latestFile)
        
        self.img3 = PhotoImage(file = latestFile)
        self.img2Label.configure(image = self.img3)
        self.img2Label.image = self.img3
Beispiel #26
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 entry(S0_entry, I0_entry, R0_entry, infection_entry, removed_entry,
          Start_entry, Stop_entry, Steps_entry):
    init, time = initial_conditions_entry(S0_entry, I0_entry, R0_entry,
                                          Start_entry, Stop_entry, Steps_entry)
    t = np.linspace(time[0], time[1], time[2])
    args = (infection_entry, removed_entry)
    X = integrate.odeint(solvr, init, t, args)

    fig = Figure()
    a = fig.add_subplot(3, 1, 1)
    ax = a.plot(t, X[:, 0])
    a.legend(ax, ['Susceptible'], loc=0)
    a.set_ylabel('population')
    P = parameters_entry(infection_entry, removed_entry)
    _a = str(P[0])
    _b = str(P[1])
    alpha = r'$\alpha=%s$' % (_a)
    beta = r'$\beta=%s$' % (_b)
    _S0 = str(init[0])
    _I0 = str(init[1])
    _R0 = str(init[2])
    S0 = 'S(0) = %s' % (_S0)
    I0 = 'I(0) = %s' % (_I0)
    R0 = 'R(0) = %s' % (_R0)
    a.set_title("Initial conditions: " + S0 + ",   " + I0 + ",   " + R0 +
                "\n" + "Parameters: " + alpha + ",   " + beta)

    b = fig.add_subplot(3, 1, 2)
    bx = b.plot(t, X[:, 1])
    b.legend(bx, ['Infected'], loc=0)
    b.set_ylabel('population')

    c = fig.add_subplot(3, 1, 3)
    cx = c.plot(t, X[:, 2])
    c.legend(cx, ['Removed'], loc=0)
    c.set_ylabel('population')
    c.set_xlabel('time')

    root = Tk()
    canvas = FigureCanvasTkAgg(fig, master=root)
    canvas.show()
    canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
    toolbar = NavigationToolbar2TkAgg(canvas, root)
    toolbar.update()
    canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
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)
def button_touch(event, msg, x, y, w, h, color, pic, screen):
    global target
    global flagrun
    screen.blit(pic, (x, y))  # paint to screen
    # in area
    if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
        if x + w > event.pos[0] > x and y + h > event.pos[1] > y:
            print(msg)
            target = msg
            Tk().wm_withdraw()  #to hide the main window
            MsgBox = tkMessageBox.askyesno(
                'Direction dialog',
                'Are you sure you want to go to room ' + msg + ' ?')
            if MsgBox == TRUE:
                # tkMessageBox.showinfo('Direction','Navigation to room ' + msg)
                pub.publish(target)  ### SEND Room target
                print('published : ' + str(target))
                flagrun = 1
            else:
                tkMessageBox.showinfo(
                    'Return', 'You will now return to the application screen')
Beispiel #30
0
def start():
    window = Tk()
    window.title('BattleShips with AI')
    window.geometry('500x500')
    menu = Menu(window)
    new_item = Menu(menu)
    new_item.add_command(label='New')
    new_item.add_command(label='Exit')
    menu.add_cascade(label='File', menu=new_item)
    window.config(menu=menu)
    lbl = Label(window, text='Enter your positions', font=('Helvetica', 25))
    lbl.grid(column=0, row=0)
    ship5 = Entry(window, width=6)
    ship5.grid(column=1, row=0)
    ship4 = Entry(window, width=6)
    ship4.grid(column=1, row=1)
    ship3_1 = Entry(window, width=6)
    ship3_1.grid(column=1, row=2)
    ship3_2 = Entry(window, width=6)
    ship3_2.grid(column=1, row=3)
    ship2 = Entry(window, width=6)
    ship2.grid(column=1, row=4)