Пример #1
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()
    def makeMenuBar(self, tk: Tkinter):
        menu = Tkinter.Menu(master=tk, bg='white')
        tk.config(menu=menu)
        file = Tkinter.Menu(menu)
        # add the exit option
        file.add_command(label='Exit', command=lambda: exit())

        # put a file menu
        menu.add_cascade(label='File', menu=file)
Пример #3
0
def raise_app(
    root: tk
):  #this function automatically activates the tkinter frame in MacOS10.10
    root.attributes("-topmost", True)
    if platform.system() == 'Darwin':
        tmpl = 'tell application "System Events" to set frontmost of every process whose unix id is {} to true'
        script = tmpl.format(os.getpid())
        output = subprocess.check_call(['/usr/bin/osascript', '-e', script])
    root.after(0, lambda: root.attributes("-topmost", False))
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()
Пример #5
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()
Пример #6
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()
Пример #7
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()
Пример #8
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()
Пример #9
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()
Пример #10
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()
Пример #11
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
Пример #12
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()
Пример #13
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()
Пример #14
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()
Пример #15
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()
Пример #16
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()
Пример #17
0
 def __internalAddSetting(self, setting_name: str, entry_object: tk,
                          var_type: type) -> None:
     """
     Abstract function which adds an object to the menu
     :param setting_name: Name of the setting
     :param entry_object: Object which is added internally
     :param var_type: Type the variable is converted to
     """
     tk.Label(self, text=setting_name).grid(row=self.__current_row,
                                            column=0,
                                            sticky="w")
     entry_object.grid(row=self.__current_row, column=1, sticky="w")
     self.__entry_inputs.append((setting_name, entry_object, var_type))
     self.__current_row += 1
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()
Пример #19
0
 def __setEntryField(self,
                     entry_field: tk,
                     text: str,
                     end_state: tk = tk.NORMAL) -> None:
     entry_field.configure(state=tk.NORMAL)
     entry_field.delete(1.0, tk.END)
     entry_field.insert(1.0, text)
     entry_field.configure(state=end_state)
Пример #20
0
def coord_to_piece(canvas: tkinter, ROWS: int, COLS: int,
                   width_window: int, height_window: int,
                   coordinate: tuple, color: str,
                   radius_x: float, radius_y: float) -> None:

    center_x = ((coordinate[1] * 2) + 1)/(COLS * 2) * width_window
    center_y = ((coordinate[0] * 2) + 1)/(ROWS * 2) * height_window

    radius_x *= width_window
    radius_y *= height_window

    canvas.create_oval(
        center_x - radius_x, center_y - radius_y,
        center_x + radius_x, center_y + radius_y,
        fill = color)
Пример #21
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()
Пример #22
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()))
Пример #23
0
def adicionarMusica():
    global listaNomes, opcoes, lista, musica_e, z, fundo, cor_fundo_escolhida, minimizar, botao_play, valor_play_pause
    jatem = False
    root = Tk()
    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:
            listaNomes.append(nome_musica.name)
            lista.append(w[0])
            musica_e = w[0]
            z = len(lista) - 1
            pygame.mixer.music.load(d)
            pygame.mixer.music.play()
        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
    minimizar = 1
    salvarLista()
    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)
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)
Пример #26
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()
Пример #27
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)
Пример #28
0
 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)
Пример #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()
                if x == mot[k]:
                    m += 1
                    MotAffiche.pop(2 * k)
                    MotAffiche.insert(2 * k, x)
            if m == 0:
                chances += -1
            else:
                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)
Пример #31
0
w = tkinter.Label(m, text='Hello World')
w.pack(side=tkinter.LEFT)
button1 = tkinter.Button(m, text='Click me', command=display)
button1.pack(side=tkinter.LEFT)
button = tkinter.Button(m, text='Exit', command=sys.exit)
button.pack(side=tkinter.RIGHT)
m.mainloop()

# 3. Create a frame using tkinter with any label text and two buttons.One to exit and other to change the label
# to some other text

import tkinter as Tk
from tkinter import *
import sys

root = Tk()

frame = Frame(root)
frame.pack()

text = StringVar()
text.set('old')
status = IntVar()


def change_label():
    if status.get() == 1:  # if clicked
        text.set('new')
    else:
        text.set('old')
Пример #32
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()