Example #1
0
button9 = tk.Button(root,
                    text="insert rule in Lisp format",
                    command=butt_input_best,
                    state=tk.DISABLED)
button9.grid(row=10, column=0, sticky=tk.W)
text9 = tk.Text(root, height=1, width=50)
text9.grid(row=10, column=1, columnspan=2)
text9.insert(tk.END, "(loves john mary)")
text9.configure(state=tk.DISABLED, foreground='grey')

buttonA = tk.Button(root,
                    text="clear rules cache",
                    command=butt_clear_cache,
                    state=tk.DISABLED)
buttonA.grid(row=11, column=0, sticky=tk.W)
msgA = tk.Message(root, width=100, text="cache size = 0")
msgA.grid(row=11, column=1, sticky=tk.W)

buttonC = tk.Button(root,
                    text="save as Excel",
                    command=butt_export_Excel,
                    state=tk.DISABLED)
buttonC.grid(row=12, column=0, sticky=tk.W)
textC = tk.Text(root, height=1, width=50)
textC.grid(row=12, column=1, columnspan=2)
textC.insert(tk.END, "rules.csv")
textC.configure(state=tk.DISABLED, foreground='grey')

# buttonD = tk.Button(root, text="quit", command=exit)
# buttonD.grid(row=1,column=0)
# buttonD = tk.Button(root, text="Plot OHLC", command=plot_OHLC)
Example #2
0
    def encrypt_form():
        if en_count.get() == 0:
            func_id.set(1)
            global encryp_form
            encryp_form = Toplevel(root)
            encryp_form.resizable(False, False)
            encryp_form.iconbitmap('email.ico')
            encryp_form.title('Creating Digital Envelope')
            made_menu(encryp_form)

            mess_frame = ttk.LabelFrame(encryp_form, text="Message file")
            mess_frame.grid(column=0,
                            row=1,
                            padx=(60, 80),
                            pady=15,
                            sticky=tk.W)

            aes_frame = ttk.LabelFrame(encryp_form, text="AES Key")
            aes_frame.grid(column=0,
                           row=2,
                           padx=(60, 80),
                           pady=15,
                           sticky=tk.W)

            rsapub_frame = ttk.LabelFrame(encryp_form, text="RSA Keys")
            rsapub_frame.grid(column=0,
                              row=3,
                              padx=(60, 80),
                              pady=15,
                              sticky=tk.W)

            manaul_make_frame = ttk.Frame(encryp_form)
            manaul_make_frame.grid(column=0, row=0, padx=30, pady=15)
            out_form = ttk.LabelFrame(encryp_form, text="Output")
            out_form.grid(column=0,
                          row=4,
                          columnspan=2,
                          padx=(60, 80),
                          pady=10,
                          sticky=tk.W)
            button_frame = ttk.Frame(encryp_form)
            button_frame.grid(column=0,
                              row=5,
                              columnspan=3,
                              padx=(60, 80),
                              pady=10,
                              sticky=tk.W)

            manual_for_make = " Creating Digital Envelope"
            manual_mes = tk.Message(manaul_make_frame,
                                    text=manual_for_make,
                                    width=700)
            manual_mes.config(fg='blue', font=('times', 16, 'italic'))
            manual_mes.grid(column=0,
                            row=0,
                            padx=4,
                            pady=12,
                            sticky=tk.W,
                            columnspan=7)

            aes_key_len = ttk.Label(aes_frame,
                                    text="Choose the length of the key:")
            fontsize_13(aes_key_len)
            aes_key_len.grid(column=0,
                             row=0,
                             padx=35,
                             pady=(12, 20),
                             sticky=tk.W)
            len_choice = ttk.Combobox(aes_frame,
                                      width=13,
                                      height=8,
                                      textvariable=keylen,
                                      state='readonly')
            len_choice['values'] = (128, 192, 256)
            len_choice.grid(column=1,
                            row=0,
                            padx=35,
                            pady=(12, 20),
                            ipady=8,
                            ipadx=8)
            len_choice.current(0)
            tt.create_Tooltip(
                len_choice, 'Choose the length of the key for AES operation')
            # aeskey_entered = ttk.Entry(aes_frame, width=50,font=fontsize_12, textvariable=aeskey,state='readonly')
            # aeskey_entered.grid(column=0, row=1,padx=8,pady=12,ipady=7,sticky=tk.EW)
            # aespassword_button = ttk.Button(aes_frame, text="AES Key Generator", command=aes_pass_generator)
            # aespassword_button.grid(column=1, row=1, padx=8,pady=12,ipady=7,ipadx=10)

            message_file = "Browse the location of the file : "
            mess_label = ttk.Label(mess_frame, text=message_file)
            fontsize_13(mess_label)
            mess_label.grid(column=0, row=0, padx=4, pady=12, sticky=tk.W)
            mes_loc_entered = ttk.Entry(mess_frame,
                                        width=30,
                                        font=fontsize_12,
                                        textvariable=message_loc)
            mes_loc_entered.grid(column=1,
                                 row=0,
                                 padx=4,
                                 pady=12,
                                 ipady=7,
                                 sticky=tk.EW)
            browse_button = ttk.Button(mess_frame,
                                       text="..",
                                       command=browse_message,
                                       width=3)
            browse_button.grid(column=2, row=0, sticky=tk.W)

            rsa_file = "Browse the public key of the receiver :"
            rsa_label = ttk.Label(rsapub_frame, text=rsa_file)
            fontsize_13(rsa_label)
            rsa_label.grid(column=0, row=0, padx=4, pady=8, sticky=tk.W)
            pub_loc_entered = ttk.Entry(rsapub_frame,
                                        width=30,
                                        font=fontsize_12,
                                        textvariable=rece_pub_loc)
            pub_loc_entered.grid(column=1,
                                 row=0,
                                 padx=4,
                                 pady=8,
                                 ipady=7,
                                 sticky=tk.EW)
            browse_button_pub = ttk.Button(rsapub_frame,
                                           text="..",
                                           command=browse_pub_rece,
                                           width=3)
            browse_button_pub.grid(column=2, row=0, sticky=tk.E)

            rsa_file = "Browse the private key of the sender :"
            rsa_label2 = ttk.Label(rsapub_frame, text=rsa_file)
            fontsize_13(rsa_label2)
            rsa_label2.grid(column=0, row=1, padx=4, pady=8, sticky=tk.W)
            priv_loc_entered = ttk.Entry(rsapub_frame,
                                         width=30,
                                         font=fontsize_12,
                                         textvariable=send_priv_loc)
            priv_loc_entered.grid(column=1,
                                  row=1,
                                  padx=4,
                                  pady=8,
                                  ipady=7,
                                  sticky=tk.EW)
            browse_button_pub = ttk.Button(rsapub_frame,
                                           text="..",
                                           command=browse_priv_send,
                                           width=3)
            browse_button_pub.grid(column=2, row=1, sticky=tk.E)

            sav_file_label = ttk.Label(
                out_form, text="Browse the folder to save the output files :")
            fontsize_13(sav_file_label)
            sav_file_label.grid(column=0, row=0, padx=4, pady=8, sticky=tk.W)
            sav_file_entered = ttk.Entry(out_form,
                                         width=30,
                                         font=fontsize_12,
                                         textvariable=sav_en_loc)
            sav_file_entered.grid(column=1,
                                  row=0,
                                  padx=4,
                                  pady=8,
                                  ipady=7,
                                  sticky=tk.EW)
            browse_button_pub = ttk.Button(out_form,
                                           text="..",
                                           command=browse_sav_file,
                                           width=3)
            browse_button_pub.grid(column=2, row=0, sticky=tk.E)

            mak_enve = ttk.Button(button_frame,
                                  text="Create an Envelope",
                                  width=10,
                                  command=_encrypt_mes)
            mak_enve.grid(column=0,
                          row=0,
                          ipadx=30,
                          padx=45,
                          ipady=15,
                          pady=(30, 20))

            menu_back = ttk.Button(button_frame,
                                   text="Back to Main Menu",
                                   width=10,
                                   command=back_menu)
            menu_back.grid(column=1,
                           row=0,
                           ipadx=30,
                           padx=45,
                           ipady=15,
                           pady=(30, 20))

            exit_button = ttk.Button(button_frame,
                                     text="Exit",
                                     width=10,
                                     command=_quit)
            exit_button.grid(column=2,
                             row=0,
                             ipadx=20,
                             padx=45,
                             ipady=15,
                             pady=(30, 20))

            #tt.create_Tooltip(aeskey_entered,
            #'Key length of 128 will be 16 symbols.\nKey Length of 192 will be 24 symbols.\nKey Length of 256 will be 32 symbols.')
            tt.create_Tooltip(mes_loc_entered,
                              'This must be the file you want to secure')
            tt.create_Tooltip(browse_button, 'Browse button')
            tt.create_Tooltip(
                pub_loc_entered,
                "The public key file(from receiver) format must be key length and two large numbers.\nOtherwise it won't work."
            )
            tt.create_Tooltip(
                priv_loc_entered,
                "The private key file(from sender) format must be key length and two large numbers.\nOtherwise it won't work."
            )
            tt.create_Tooltip(
                sav_file_entered,
                'Choose the folder you want to keep the output file.')

        elif en_count.get() > 0:
            root.withdraw()
            encryp_form.update()
            encryp_form.deiconify()
Example #3
0
    def decrypt_form():
        if de_count.get() == 0:
            func_id.set(2)
            global decryp_form
            decryp_form = Toplevel(root)
            decryp_form.resizable(False, False)
            decryp_form.iconbitmap('email.ico')
            decryp_form.title("Opening Digital Envelope")
            made_menu(decryp_form)
            #decryp_form.grid(column=0,row=0,sticky=tk.W)

            manaul_open_frame = ttk.Frame(decryp_form)
            manaul_open_frame.grid(column=0, row=0, padx=30, pady=15)

            crypfile_form = ttk.LabelFrame(decryp_form,
                                           text="Encrypted File & AES Key")
            crypfile_form.grid(column=0,
                               row=1,
                               padx=(60, 100),
                               pady=10,
                               sticky=tk.W)

            priv_form = ttk.LabelFrame(decryp_form, text="RSA Keys")
            priv_form.grid(column=0,
                           row=2,
                           padx=(60, 100),
                           pady=10,
                           sticky=tk.W)

            out_form_open = ttk.LabelFrame(decryp_form, text="Output")
            out_form_open.grid(column=0,
                               row=3,
                               columnspan=2,
                               padx=(60, 100),
                               pady=10,
                               sticky=tk.W)

            button_frame = ttk.Frame(decryp_form)
            button_frame.grid(column=0,
                              row=4,
                              columnspan=3,
                              padx=(60, 100),
                              pady=10,
                              sticky=tk.W)

            manual_for_open = "Opening Digital Envelope"
            manual_mes = tk.Message(manaul_open_frame,
                                    text=manual_for_open,
                                    width=600)
            manual_mes.config(fg='blue', font=('times', 16, 'italic'))
            manual_mes.grid(column=0, row=0, padx=4, pady=12, sticky=tk.W)

            cryp_txt = "Browse the folder where encrypted file and encrypted key exist :"
            cryp_label = ttk.Label(crypfile_form, text=cryp_txt)
            fontsize_13(cryp_label)
            cryp_label.grid(column=0,
                            row=0,
                            padx=4,
                            pady=12,
                            columnspan=2,
                            sticky=tk.W)

            cryp_file_entered = ttk.Entry(crypfile_form,
                                          width=45,
                                          font=fontsize_10,
                                          textvariable=cryp_loc)
            cryp_file_entered.grid(column=0,
                                   row=1,
                                   padx=4,
                                   pady=12,
                                   ipady=7,
                                   sticky=tk.W)
            tt.create_Tooltip(cryp_file_entered,
                              "This must be encrypted_file.txt")
            browse_button_cryp = ttk.Button(crypfile_form,
                                            text="..",
                                            command=browse_cryp,
                                            width=3)
            browse_button_cryp.grid(column=1,
                                    row=1,
                                    padx=8,
                                    pady=12,
                                    sticky=tk.W)
            tt.create_Tooltip(browse_button_cryp, "Browse button")

            # cryp_key = "Browse the encrypted key file : "
            # cryp_key = ttk.Label(crypfile_form, text=cryp_key)
            # fontsize_13(cryp_key)
            # cryp_key.grid(column=0, row=2, padx=4, pady=12, sticky=tk.W)
            #
            # cryp_key_entered = ttk.Entry(crypfile_form, width=63, font=fontsize_10, textvariable=cryp_key_loc)
            # cryp_key_entered.grid(column=0, row=3, padx=4, pady=12, ipady=7, sticky=tk.EW)
            # tt.create_Tooltip(cryp_key_entered, "This must be encrypted_key.txt")
            # browse_button_cryp = ttk.Button(crypfile_form, text="..", command=browse_cryp_key, width=3).grid(column=1, row=3,padx=8,pady=12,
            #                                                                                              sticky=tk.W)
            rsa_file = "Browse the private key of the receiver :"
            rsa_label = ttk.Label(priv_form, text=rsa_file)
            fontsize_13(rsa_label)
            rsa_label.grid(column=0, row=0, padx=4, pady=12, sticky=tk.W)

            priv_loc_entered = ttk.Entry(priv_form,
                                         width=30,
                                         font=fontsize_10,
                                         textvariable=rece_priv_loc)
            priv_loc_entered.grid(column=1,
                                  row=0,
                                  padx=4,
                                  pady=12,
                                  ipady=7,
                                  sticky=tk.EW)
            tt.create_Tooltip(
                priv_loc_entered,
                "This file must be private key of the receiver.\nThis must have the format of key length and two large numbers.Otherwise it won't work."
            )
            browse_button_priv = ttk.Button(priv_form,
                                            text="..",
                                            command=browse_priv_rece,
                                            width=3).grid(column=2,
                                                          row=0,
                                                          padx=8,
                                                          sticky=tk.E)

            rsa_file = "Browse the public key of the sender :"
            rsa_label2 = ttk.Label(priv_form, text=rsa_file)
            fontsize_13(rsa_label2)
            rsa_label2.grid(column=0, row=1, padx=4, pady=12, sticky=tk.W)

            pub_loc_entered = ttk.Entry(priv_form,
                                        width=30,
                                        font=fontsize_10,
                                        textvariable=send_pub_loc)
            pub_loc_entered.grid(column=1,
                                 row=1,
                                 padx=4,
                                 pady=12,
                                 ipady=7,
                                 sticky=tk.EW)
            tt.create_Tooltip(
                pub_loc_entered,
                "This file must be the public key of the receiver.\nThis must have the format of key length,two large numbers.Otherwise it won't work."
            )
            browse_button_pub = ttk.Button(priv_form,
                                           text="..",
                                           command=browse_pub_send,
                                           width=3).grid(column=2,
                                                         row=1,
                                                         padx=8,
                                                         sticky=tk.E)

            sav_file_label = ttk.Label(
                out_form_open,
                text="Browse the folder to save the output files :")
            fontsize_13(sav_file_label)
            sav_file_label.grid(column=0, row=0, padx=8, pady=8, sticky=tk.W)
            sav_file_entered = ttk.Entry(out_form_open,
                                         width=25,
                                         font=fontsize_12,
                                         textvariable=sav_de_lc)
            sav_file_entered.grid(column=1,
                                  row=0,
                                  padx=8,
                                  pady=8,
                                  ipady=7,
                                  sticky=tk.EW)
            tt.create_Tooltip(
                sav_file_entered,
                "Choose the folder you want to keep the output file.")
            browse_button_pub = ttk.Button(out_form_open,
                                           text="..",
                                           command=browse_sav_rece,
                                           width=3).grid(column=2,
                                                         row=0,
                                                         pady=8,
                                                         padx=8,
                                                         sticky=tk.E)
            open_enve = ttk.Button(button_frame,
                                   text="Open an Envelope",
                                   width=10,
                                   command=_open_mes)
            open_enve.grid(column=0,
                           row=0,
                           ipadx=30,
                           padx=45,
                           ipady=15,
                           pady=(40, 20))

            menu_back = ttk.Button(button_frame,
                                   text="Back to Main Menu",
                                   width=10,
                                   command=back_menu)
            menu_back.grid(column=1,
                           row=0,
                           ipadx=30,
                           padx=45,
                           ipady=15,
                           pady=(40, 20))

            exit_button = ttk.Button(button_frame,
                                     text="Exit",
                                     width=10,
                                     command=_quit)
            exit_button.grid(column=2,
                             row=0,
                             ipadx=20,
                             padx=45,
                             ipady=15,
                             pady=(40, 20))
        elif de_count.get() > 0:
            root.withdraw()
            decryp_form.update()
            decryp_form.deiconify()
Example #4
0
        def buscar():
            def cerrar_exp():
                medicos.destroy()
                #medicos.eval('::ttk::CancelRepeat')
                self.buscar_medico()

            dato = self.controller.buscar_medico(
                self.util.validar_cadena(str(codigo.get()), True))

            if dato != None and len(dato) > 0:

                lbl_codigo = tkinter.Label(medicos,
                                           font='Arial',
                                           text="Código",
                                           justify='left')
                lbl_codigo.place(bordermode='outside',
                                 height=20,
                                 width=300,
                                 x=50,
                                 y=55)
                lbl_nombre = tkinter.Label(medicos,
                                           font='Arial',
                                           text="Nombre Completo",
                                           justify='left')
                lbl_nombre.place(bordermode='outside',
                                 height=20,
                                 width=300,
                                 x=50,
                                 y=80)
                lbl_documento_identidad = tkinter.Label(
                    medicos,
                    font='Arial',
                    text="Documento de identidad",
                    justify='left')
                lbl_documento_identidad.place(bordermode='outside',
                                              height=20,
                                              width=300,
                                              x=50,
                                              y=105)
                lbl_cargo = tkinter.Label(medicos,
                                          font='Arial',
                                          text="Cargo",
                                          justify='left')
                lbl_cargo.place(bordermode='outside',
                                height=20,
                                width=300,
                                x=50,
                                y=130)

                codigo_result = tkinter.Label(medicos,
                                              font='Arial',
                                              text=dato['codigo'],
                                              justify='left')
                codigo_result.place(bordermode='outside',
                                    height=20,
                                    width=300,
                                    x=350,
                                    y=55)
                nombre_result = tkinter.Label(medicos,
                                              font='Arial',
                                              text=dato['nombrecompleto'],
                                              justify='left')
                nombre_result.place(bordermode='outside',
                                    height=20,
                                    width=300,
                                    x=350,
                                    y=80)
                documento_identidad_result = tkinter.Label(medicos,
                                                           font='Arial',
                                                           text=dato['cedula'],
                                                           justify='left')
                documento_identidad_result.place(bordermode='outside',
                                                 height=20,
                                                 width=300,
                                                 x=350,
                                                 y=105)
                cargo_result = tkinter.Label(medicos,
                                             font='Arial',
                                             text=dato['cargo'],
                                             justify='left')
                cargo_result.place(bordermode='outside',
                                   height=20,
                                   width=300,
                                   x=350,
                                   y=130)
            else:

                alerta = tkinter.Message(medicos,
                                         relief='raised',
                                         text='Médico no encontrado',
                                         width=200)
                alerta.place(bordermode='outside',
                             height=150,
                             width=200,
                             y=30,
                             x=150)
                ok = tkinter.Button(alerta, text="Ok", command=cerrar_exp)
                ok.pack(side="bottom")
Example #5
0
    def __init__(self, tk_root, registered_ip, registered_port):
        self.info = None
        if registered_ip is None:
            registered_ip = ''
        if registered_port is None:
            registered_port = ''

        tk.Frame.__init__(self, tk_root)
        self.tk_root = tk_root
        self.tk_root.resizable(False, False)

        message_frame = tk.Frame(self)
        message_frame.pack(fill="both", expand="yes")
        message = tk.Message(
            message_frame,
            font='System 14 bold',
            text=_("""This tool requires Internet access for some services, 
                such as DOI, affiliations, and other data validations,
                and also to get journals data from SciELO.\n
                If you do not use a proxy to access the Internet,
                and click on Cancel button."""),
            wraplength=450)
        message.pack()

        proxy_ip_frame = tk.Frame(self)
        proxy_ip_frame.pack(fill="both", expand="yes")
        label_proxy_ip = tk.Label(proxy_ip_frame, text='Proxy IP / server')
        label_proxy_ip.pack(fill="both", expand="yes")
        self.proxy_ip_entry = tk.Entry(proxy_ip_frame)
        self.proxy_ip_entry.insert(0, registered_ip)
        self.proxy_ip_entry.pack()
        self.proxy_ip_entry.focus_set()

        proxy_port_frame = tk.Frame(self)
        proxy_port_frame.pack(fill="both", expand="yes")
        proxy_port_label = tk.Label(proxy_port_frame, text='Proxy Port')
        proxy_port_label.pack(fill="both", expand="yes")
        self.proxy_port_entry = tk.Entry(proxy_port_frame)
        self.proxy_port_entry.insert(0, registered_port)
        self.proxy_port_entry.pack()

        proxy_user_frame = tk.Frame(self)
        proxy_user_frame.pack(fill="both", expand="yes")
        proxy_user_label = tk.Label(proxy_user_frame, text=_('user'))
        proxy_user_label.pack(fill="both", expand="yes")
        self.proxy_user_entry = tk.Entry(proxy_user_frame)
        self.proxy_user_entry.pack()

        proxy_pass_frame = tk.Frame(self)
        proxy_pass_frame.pack(fill="both", expand="yes")
        proxy_pass_label = tk.Label(proxy_pass_frame, text=_('password'))
        proxy_pass_label.pack(fill="both", expand="yes")
        self.proxy_pass_entry = tk.Entry(proxy_pass_frame, show='*')
        self.proxy_pass_entry.pack()

        buttons_frame = tk.Frame(self)
        buttons_frame.pack(fill="both", expand="yes")

        cancel_button = tk.Button(buttons_frame,
                                  text=_('Cancel'),
                                  command=lambda: self.tk_root.quit())
        cancel_button.pack(side='right')

        execute_button = tk.Button(buttons_frame,
                                   text=_('OK'),
                                   command=self.register)
        execute_button.pack(side='right')
Example #6
0
def createWindow(window):
    '''Function creates gui window that user interacts with
    Widgets are grouped by frames (top,middle,bottom).
    wordLabel & defLabel are global so other methods can adjust'''
    global wordLabel, defLabel

    window.title("Hangman App")
    window.geometry('800x500+0+0')
    window.resizable(0,0)

    topFrame = tk.Frame(window,width=800,height=150)
    middleFrame = tk.Frame(window,width=800,height=200)
    bottomFrame = tk.Frame(window,width=800,height=150)


    window.grid_rowconfigure(1,weight=0)
    window.grid_columnconfigure(0,weight=0)

    topFrame.grid(row=0)
    middleFrame.grid(row=5)
    bottomFrame.grid(row=10)


    #left side labels
    label1 = ttk.Label(topFrame,text="Letter Guess: ")
    label2 = ttk.Label(topFrame,text="Word Guess: ")

    #middle labels
    label3 = ttk.Label(middleFrame,text="Word:")
    wordLabel = tk.Label(middleFrame,relief="solid")
    label4 = ttk.Label(middleFrame,text="Definition:")
    defLabel = tk.Message(middleFrame,relief="solid")

    #set entry
    letterBox = ttk.Entry(topFrame,textvariable=LETTER_ANS)
    wordBox = ttk.Entry(topFrame,textvariable=WORD_ANS)

    #right side buttons
    letterButton = tk.Button(topFrame,text="Guess Letter",
	command=guessLetterClick)
    wordButton = tk.Button(topFrame,text="Guess Word",
	command=guessWordClick)

    #Bottom buttons
    helpButton = tk.Button(bottomFrame,text="Help",command=helpClick)
    easyButton = tk.Button(bottomFrame,text="Easy",command=easyClick)
    medButton = tk.Button(bottomFrame,text="Medium",command=medClick)
    hardButton = tk.Button(bottomFrame,text="Hard",command=hardClick)
    closeButton = tk.Button(bottomFrame,text="Close",command=closeProg)


    #changing the font
    label1.config(font=44)
    label2.config(font=44)

    label3.config(font=33)
    label4.config(font=33)
    wordLabel.config(width=50,height=5,font=44)
    defLabel.config(font=44,width=500)


    label1.grid(row=0,column=0,pady=20)
    label2.grid(row=1,column=0)

    label3.grid(row=5,column=0)
    wordLabel.grid(row=5,columnspan=13,column=1,pady=20,padx=20)
    label4.grid(row=6,column=0)
    defLabel.grid(row=6,columnspan=13,column=1)

    letterBox.grid(row=0,column=1)
    wordBox.grid(row=1,column=1)

    letterButton.grid(row=0,column=2)
    wordButton.grid(row=1,column=2)


    helpButton.grid(row=10,column=0,pady=20,padx=20)
    easyButton.grid(row=10,column=1)
    medButton.grid(row=10,column=2)
    hardButton.grid(row=10,column=3)
    closeButton.grid(row=10,column=4,pady=20,padx=20)

    helpButton.config(height=2, width=7)
    closeButton.config(height=2,width=7)
    easyButton.config(height=2, width=7,bg="green")
    medButton.config(height=2,width=7,bg="yellow")
    hardButton.config(height=2,width=7,bg="red")

    #make user exit with close button
    window.protocol('WM_DELETE_WINDOW',closeMessage)
    window.deiconify()
    wn = turtle.Screen()
    drawOutline()

    window.mainloop()
Example #7
0
def show_dialog():
    fromonk_text = "this is an example"
    CustomDialog(root, title="Example", text=fromonk_text)


root = tk.Tk()
# top = tk.Toplevel()
# top.title('TkFloat')
button1 = tk.Button(root, text="Close", command=root.destroy)
button1.pack(padx=20, pady=20)
button = tk.Button(root, text="Show", command=show_dialog)
button.pack(padx=20, pady=20)
w = tk.Canvas(root, width=200, height=360)
w.pack()
var1 = tk.IntVar()
tk.Checkbutton(w, text='male', variable=var1).grid(row=0, sticky=tk.W)
var2 = tk.IntVar()
tk.Checkbutton(w, text='female', variable=var2).grid(row=1, sticky=tk.W)

tk.Label(w, text='First Name').grid(row=2)
tk.Label(w, text='Last Name').grid(row=3)
e1 = tk.Entry(w)
e2 = tk.Entry(w)
e1.grid(row=2, column=1)
e2.grid(row=3, column=1)
ourMessage = 'This is our Message'
messageVar = tk.Message(root, text=ourMessage, width=80)
messageVar.config(bg='lightgreen', width=80)
messageVar.pack(fill=tk.BOTH)
root.mainloop()

m_window = tkinter.Tk()

# Setup the main window and frames for the player and computer player
m_window.title('Rock, Paper, Scissors')
m_window.geometry('265x300-800-400')  # Creates an offset to put the window in the middle of the monitor
m_window.configure(background='black')

# The frame for the message section
message_frame = tkinter.Frame(m_window)
message_frame.grid(row=1, column=0, columnspan=3)

# The message section at the top that displays the rules
rules_text = tkinter.StringVar()
rules = tkinter.Message(m_window, textvariable=rules_text, justify='center', background='black',
                        foreground='white', font='bold')
rules_text.set('Rules:\nRock beats Scissors\nScissors beat Paper\nPaper beats Rock\n\n' +
               'Click on your piece below!')
rules.grid(row=0, column=0)

# The frame for the buttons
button_frame = tkinter.Frame(m_window, background='black')
button_frame.grid(row=2, column=0, columnspan=3)

# Player buttons
rock_button = tkinter.Button(button_frame, text='Rock', command=rock)
rock_button.grid(row=0, column=0)
paper_button = tkinter.Button(button_frame, text='Paper', command=paper)
paper_button.grid(row=0, column=1)
scissors_button = tkinter.Button(button_frame, text='Scissors', command=scissors)
scissors_button.grid(row=0, column=2)
Example #9
0
msg = tkinter.Label(mon_app, text="Bienvenue à tous !")

print(msg["text"])  #afficherle msg au terminal en tant que dictionnaire
print(msg.cget("text"))  #afficherle msg au terminal par methode

msg["text"] = "Hello evry one !"  #changer le msg en tant que dictionnaire
msg.config(
    text="Hollaaaaaaaaaaaaaaaaaaaaaaaaaa !")  #changer le msg par methode

msg.pack()
mon_app.mainloop()

#Message   elle passe à la ligne seul
mon_app = tkinter.Tk()
mon_app.title("Mon premier programme interface")
msg = tkinter.Message(mon_app, text="Bonjour et Bienvenue à tous  !")
msg.pack()
mon_app.mainloop()

#Entry
mon_app = tkinter.Tk()
mon_app.title("Mon premier programme interface")
msg = tkinter.Entry(mon_app, show="*")  #show pour le mot de passe
msg.pack()
mon_app.mainloop()

mon_app = tkinter.Tk()
mon_app.title("Mon premier programme interface")
msg = tkinter.Entry(
    mon_app, exportselection=0)  #exportselection empecher la selection du text
msg.pack()
Example #10
0
 def help_game():
     top = tk.Toplevel()
     top.title("About Check Out Line")
     msg = tk.Message(top, text=HELP_TEXT).pack()
Example #11
0
imageFrame.grid(row=1, column=1, padx=0, pady=0)

#Windows for each emotion (sorrow, anger, surprise, joy)
sorrowText = tk.StringVar()
angerText = tk.StringVar()
surpriseText = tk.StringVar()
joyText = tk.StringVar()

sorrowText.set("Sorrow text")
angerText.set("Anger text")
surpriseText.set("Surprise text")
joyText.set("Joy text")

sorrowDisplay = tk.Message(window,
                           width=200,
                           font=30,
                           textvariable=sorrowText,
                           bg="white")
angerDisplay = tk.Message(window,
                          width=200,
                          font=30,
                          textvariable=angerText,
                          bg="white")
surpriseDisplay = tk.Message(window,
                             width=200,
                             font=30,
                             textvariable=surpriseText,
                             bg="white")
joyDisplay = tk.Message(window,
                        width=200,
                        font=30,
Example #12
0
def gameplay():
    story = [{
        "Hi. Do we start?": {
            "Y": 1,
            "N": 2
        }
    }, {
        "Good choice. Is this a test?": {
            "Ya": 3,
            "Na": 4
        }
    }, {
        "Why? Not ready yet?": {
            "Yo": 5,
            "No": 6
        }
    }, {
        "A test for what? NUKE?": {
            "N": 6,
            "Y": 5
        }
    }, {
        "Ah I got Scared.": {
            "Why": 5,
            "What": 6
        }
    }, {
        "This was a nuke test.": {
            "I was right!": 6,
            "Hell yeah!": 6
        }
    }, {
        "Congrats, you beat the game and came to the end. Please save and quit.":
        {
            "Please": 6,
            "Save": 6
        }
    }]
    global questnow
    global seqnow
    global optval1
    global optval2
    gamewindow = tk.Tk()
    gamewindow.wm_title("NUKEBLITZ - Play in progress....")
    gamewindow.iconbitmap("icon.ico")
    gamewindow.geometry("450x250+400+200")
    gamewindow.config(bg="lightblue")
    gamewindow.resizable(10, 10)
    quesdict = story[questnow]
    quescont = [i for i in quesdict][0]
    questext = tk.Message(gamewindow, text=quescont, bg="lightblue")
    questext.config(width=500)
    questext.pack(side=tk.TOP, anchor="center", padx=5, pady=5)
    optdict = quesdict[quescont]
    options = [i for i in optdict]
    optval1 = optdict[options[0]]
    optval2 = optdict[options[1]]
    button1 = tk.Button(gamewindow,
                        text=options[0],
                        fg="blue",
                        bg="lightgreen",
                        command=lambda: destroyer(gamewindow, opt1))
    button1.config(width=30)
    button1.pack(padx=15, pady=15, anchor="center")
    button2 = tk.Button(gamewindow,
                        text=options[1],
                        fg="blue",
                        bg="lightgreen",
                        command=lambda: destroyer(gamewindow, opt2))
    button2.config(width=30)
    button2.pack(padx=10, pady=5, anchor="center")
    menubutton = tk.Button(gamewindow,
                           text="MENU",
                           fg="red",
                           bg="yellow",
                           command=lambda: ingamemenu(gamewindow))
    menubutton.config(width=30)
    menubutton.pack(padx=10, pady=30)
Example #13
0
        buttons.pack(side=tk.LEFT, padx=20, pady=30, anchor="center")


while True:
    import ctypes
    sound()
    mm = tk.Tk()
    mm.wm_title("NUKEBLITZ - The Game")
    mm.iconbitmap("icon.ico")
    mm.geometry("450x250+400+200")
    mm.config(bg="red")
    mm.resizable(10, 10)
    name1 = "NUKE"
    name2 = "BLITZ"
    name3 = ""
    n1 = tk.Message(mm, text=name1)
    n1.config(bg='red', font=('Arial', 20, 'bold'))
    n1.pack(side=tk.TOP, fill=tk.BOTH, pady=10)
    n2 = tk.Message(mm, text=name2)
    n2.config(bg='red', font=('Arial', 20, 'bold'))
    n2.pack(side=tk.TOP, fill=tk.BOTH)
    n3 = tk.Message(mm, text=name3)
    n3.config(bg='red', font=('Arial', 20, 'bold'))
    n3.pack(side=tk.TOP, fill=tk.BOTH)
    startgame = tk.Button(mm,
                          text="Start Game",
                          fg="green",
                          bg="yellow",
                          command=loadopt)
    startgame.config(width=20)
    startgame.pack(pady=5, anchor="center")  #side=tk.LEFT,padx=30,pady=20,
Example #14
0
    # img = il.load(pm.resources_path("gui/Flower-bud-003.jpg"), force_format=[None, None, 3])[0]
    img, depth = hio.load(resources_path("gui/hand.mat"), format=(hio.RGB_DATA, hio.DEPTH_DATA))

    # off = (img.shape[0]-img.shape[1])//2
    # img = np.pad(img, pad_width=((0, 0), (off, off), (0, 0)), mode='constant')
    # img = skt.resize(img, output_shape=(700, 700))

    # Setup the pinner
    pinner = pc.PinpointerCanvas(canvas_frame)
    setup_pinner(pinner, img, depth)

    # load the helper data into a dictionary
    # helper_hand['data'] is the image
    # helper_hand['labels'] are the points
    helper_hand = scio.loadmat(resources_path("gui/sample_hand.mat"))

    # Setup the helper
    helper = hh.HelperCanvas(side_frame)
    setup_helper(helper, helper_hand)
    helper_ref = helper
    descriptor = tk.Message(side_frame,
                            text=helptext,
                            justify=tk.LEFT,
                            font=('Arial', 10, 'bold'))
    descriptor.pack(side=tk.TOP)

    # This enables resizing, but it's quite buggy. Do it at your own risk.
    # root.bind("<Configure>", lambda event: pinner.resize(event.width-2, event.height-2))

    root.mainloop()
Example #15
0
    def __init__(self):
        """
        Initialize and generate GUI
        """
        self.root = tk.Tk()
        self.root.title('LOFAR Imaging Text Generator')
        self.root.option_add('*Font', 'helvetica 11')

        frame = tk.Frame(self.root, padx=10, pady=5)
        frame.grid()

        rowIdx = 0
        projNameL = tk.Label(frame, text='Project Name:')
        projNameL.grid(row=rowIdx, sticky='E')
        self.projNameT = tk.Entry(frame, width=7)
        self.projNameT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        mainNameL = tk.Label(frame, text='Main folder name:')
        mainNameL.grid(row=rowIdx, sticky='E')
        self.mainNameT = tk.Entry(frame)
        self.mainNameT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        dateL = tk.Label(frame, text='Start date/time:')
        dateL.grid(row=rowIdx, sticky='E')
        self.dateT = tk.Entry(frame)
        self.dateT.insert(0,
                          datetime.datetime.now().strftime(
                              '%Y-%m-dd-hh-mm-00'))  #'yyyy-mm-dd-hh-mm-ss')
        #self.dateT.bind('<Button-1>', self.clearEntry)
        self.dateT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        elevationL = tk.Label(frame, text='Min. '+\
                                   'elevation (deg):')
        elevationL.grid(row=rowIdx, sticky='E')
        self.elevationT = tk.Entry(frame, width=5)
        self.elevationT.insert(tk.END, '30')
        self.elevationT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        avgL = tk.Label(frame, text='Freq. and time. averaging:')
        avgL.grid(row=rowIdx, sticky='E')
        self.avgT = tk.Entry(frame, width=5)
        self.avgT.insert(0, '4,1')
        #self.avgT.bind('<Button-1>', self.clearEntry)
        self.avgT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        arrayConfigL = tk.Label(frame, text='Array configuration:')
        arrayConfigL.grid(row=rowIdx, sticky='E')
        self.arrayConfigStr = tk.StringVar()
        arrayConfig = ['Super-terp only', 'Core stations', 'Dutch stations',\
                       'International']
        self.arrayConfigStr.set('International')
        self.arrayConfigOption = tk.OptionMenu(frame, \
                                      self.arrayConfigStr, *arrayConfig)
        self.arrayConfigOption.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        subbandL = tk.Label(frame, text='Sub band list:')
        subbandL.grid(row=rowIdx, sticky='E')
        self.freqModeStr = tk.StringVar()
        freqModes = ['10-90 MHz', '30-90 MHz', '110-190 MHz', '170-230 MHz',\
                     '210-250 MHz']
        self.freqModeStr.set('110-190 MHz')
        self.freqModeOption = tk.OptionMenu(frame, self.freqModeStr, \
                                            *freqModes, \
                                            command=self._changeAntennaMode)
        self.freqModeOption.grid(row=rowIdx, column=1, sticky='W')
        rowIdx += 1
        self.subbandOption = tk.IntVar()
        self.subbandR1 = tk.Radiobutton(frame, text='Tier-1', \
                                        variable=self.subbandOption, value=1,\
                                        command=self._setSubbandText)
        self.subbandR1.grid(row=rowIdx, column=1, sticky='W')
        self.subbandR2 = tk.Radiobutton(frame, text='user-defined', \
                                        variable=self.subbandOption, value=2,\
                                        command=self._setSubbandText)
        self.subbandR2.grid(row=rowIdx, column=1, padx=80, sticky='W')
        rowIdx += 1
        self.subbandT = tk.Entry(frame, width=45)
        self.subbandT.configure(state='readonly')
        self.subbandT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        AntennaModeL = tk.Label(frame, text='Antenna mode:')
        AntennaModeL.grid(row=rowIdx, sticky='E')
        self.antennaModeStr = tk.StringVar()
        self.antennaModeStr.set('HBA Dual Inner')
        antMode = ['HBA Zero', 'HBA Zero Inner', 'HBA One', \
                   'HBA One Inner', 'HBA Dual', 'HBA Dual Inner', \
                   'HBA Joined', 'HBA Joined Inner']
        self.antennaModeOption = tk.OptionMenu(frame, \
                                               self.antennaModeStr, *antMode)
        self.antennaModeOption.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        pointL = tk.Message(frame, text='Target pointing details '+\
                                 '(use multiple lines for '+\
                                 'multiple sources):', width=170)
        pointL.grid(row=rowIdx, sticky='E')
        self.pointT = tk.Text(frame, height=3, width=45)
        self.pointT.insert(tk.END, '<label>,<ra (hms)>,<dec (dms)>,<demix>')
        self.pointT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        durationL = tk.Label(frame, text='Target duration (hours):')
        durationL.grid(row=rowIdx, sticky='E')
        self.durationT = tk.Entry(frame, width=5)
        self.durationT.insert(0, '8')
        self.durationT.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        compressL = tk.Label(frame, text='Dysco compression:')
        compressL.grid(row=rowIdx, sticky='E')
        self.dyscoModeStr = tk.StringVar()
        self.dyscoModeStr.set('Enabled')
        dyscoMode = ['Enabled', 'Disabled']
        self.dyscoModeOption = tk.OptionMenu(frame, self.dyscoModeStr, \
                                             *dyscoMode)
        self.dyscoModeOption.grid(row=rowIdx, column=1, sticky='W')

        rowIdx += 1
        self.submitB = tk.Button(frame, text='SUBMIT', justify=tk.CENTER,\
                                 command=self.actionSubmit)
        self.submitB.grid(row=rowIdx, column=1, sticky='W', pady=10)

        self.cancelB = tk.Button(frame, text='RESET', justify=tk.CENTER,\
                                 command=self.resetForms)
        self.cancelB.grid(row=rowIdx, column=1, padx=100, sticky='W', pady=10)
        self.momB = tk.Button(frame, text='Open MoM', justify=tk.CENTER, \
                                 command=self.openMoM)
        self.momB.grid(row=0, column=1, padx=100, sticky='E', pady=10)
Example #16
0
# message = Message(master, option, ...)
# HAS SAME PROPERTIES AS LABEL(See above)

import tkinter as tk


def do_it_again():
    text.set(text.get() + "and again...")


window = tk.Tk()
window.title('Message')
button = tk.Button(window, text="Go ahead!", command=do_it_again)
button.pack()
text = tk.StringVar()
message = tk.Message(window, textvariable=text, width=400)
text.set("You did it again... ")
message.pack()
window.mainloop()

# This program continually adds 'and again...' to the end of a string, increasing the size of the window to fit it.

# <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> #

# FRAME
# The frame widget is a container designed to hold other widgets.
# This means that the Frame can be used to separate a rectangular part of the window and to treat it as a kind of local window.
# Such a window works as a master widget for all the widgets embedded within it.
# Moreover, the Frame has its own coordinate system, so when you place a widget inside a Frame, you measure its location relative
# to the Frame’s upper-left corner, not the window’s one.
# It also means that if you move the Frame to a new position, all its inner widgets will go with it.
Example #17
0
import turtle
import atexit
import sys
######################Imports###################################

####################Global Variables############################
USER_WINDOW = tk.Tk()			#GUI used for user interaction
FINAL_DEF = []					#holds the final definition
DEFINITIONS = []				#holds ALL definitions (.txt file)
LETTER_ANS = StringVar()		#User letter answer to check
WORD_ANS = StringVar()			#User word answer to check
DIFFICULTY = ""					#holds user's difficulty for the round
ANS_FLAG = False				#checks if user selected difficulty
GAME_OVER = False               #checks if user guessed or lost
wordLabel = tk.Label()          #change word label text on buttonCLick
defLabel = tk.Message()         #change def label text on buttonClik
WORD = ""                       #holds word to be guessed
BLANK_WORD = []                 #holds blanks string that will change throughout
OUTPUTWORD = ""                 #word output based on blank_word[] changing
CHANCE_COUNTER = 7              #counts the chances user has left to solve
REPEAT_LIST = []                #checks if letter has already been used
LETTER_COUNT = 0                #compare to word length if equal, word was guessed
frank = turtle.Turtle()         #create turtle to move
#####################Global Variables############################


################Code for tkinter window###########################

def createWindow(window):
    '''Function creates gui window that user interacts with
    Widgets are grouped by frames (top,middle,bottom).
Example #18
0
    def __init__(self):
        """Constructor for a GUI for Student."""
        self._root = tk.Tk()

        # -------------- one message widget ---------------------
        header = "Enter student info"
        self._header = tk.Message(self._root, text=header)
        self._header.config(font=("times", 18, "italic"),
                            bg="lightblue", width=300)

        # ----------------- some label widgets ------------------
        self._label_name = tk.Label(self._root, text="Name",
                                    padx=20, pady=10)
        self._label_grade = tk.Label(self._root, text="Grade",
                                     padx=20, pady=10)
        self._label_address = tk.Label(self._root, text="Address",
                                       padx=20, pady=10)
        self._label_phone = tk.Label(self._root, text="Phone",
                                     padx=20, pady=10)

        # Assume this will be used to show list of students at the start
        self._label_answer_text = tk.Label(self._root, padx=20, pady=10)
        self._label_answer_value = tk.Label(self._root, padx=20, pady=10)

        # ----------------- some entry widgets ------------------
        self._entry_name = tk.Entry(self._root)
        self._entry_name.insert(0, self.DEFAULT_NAME)
        self._entry_grade = tk.Entry(self._root)
        self._entry_grade.insert(0, str(self.DEFAULT_GRADE))
        self._entry_address = tk.Entry(self._root)
        self._entry_address.insert(0, self.DEFAULT_ADDRESS)
        self._entry_phone = tk.Entry(self._root)
        self._entry_phone.insert(0, self.DEFAULT_PHONE)

        # ----------------- some button widgets ------------------
        self._button_add = tk.Button(self._root, text="Add",
                                     command=self._add_student)
        self._button_remove = tk.Button(self._root, text="Remove",
                                        command=self._remove_student)
        self._button_student_info = tk.Button(self._root, text="Student Info",
                                              command=self._student_info)
        self._button_all_students = tk.Button(self._root, text="All Students",
                                              command=self._all_students)

        # ------------ place all widgets using grid layout -------------
        self._header.grid(row=0, column=0, columnspan=2, sticky=tk.EW)

        self._label_name.grid(row=1, column=0, sticky=tk.E)
        self._entry_name.grid(row=1, column=1, padx=25, sticky=tk.W)

        self._label_grade.grid(row=2, column=0, sticky=tk.E)
        self._entry_grade.grid(row=2, column=1, padx=25, sticky=tk.W)

        self._label_address.grid(row=3, column=0, sticky=tk.E)
        self._entry_address.grid(row=3, column=1, padx=25, sticky=tk.W)

        self._label_phone.grid(row=4, column=0, sticky=tk.E)
        self._entry_phone.grid(row=4, column=1, padx=25, sticky=tk.W)

        self._label_answer_text.grid(row=5, column=0, pady=4, sticky=tk.E)
        self._label_answer_value.grid(row=5, column=1, sticky=tk.W)

        self._button_add.grid(row=6, column=0, padx=20, sticky=tk.EW)
        self._button_remove.grid(row=6, column=1, padx=20, sticky=tk.EW)

        self._button_student_info.grid(row=7, column=0, padx=25, pady=15,
                                       sticky=tk.EW)
        self._button_all_students.grid(row=7, column=1, padx=25, pady=15,
                                       sticky=tk.EW)

        # ------ Initialize a list to hold students as they are added -----
        self._students = []

        # to make testing easier
        # self._students = [
        #     Student("JP", 10),
        #     Student("Jasmine", 10),
        #     Student("Bresy", 11),
        #     Student("Francisco", 11),
        #     Student("Jonathan", 11),
        #     Student("Jacob", 12),
        # ]

        self._display_students()
# The first part is where the dimensions and other details about the window are set.
root = tk.Tk()
root.title("Welcome to Budget calculator")
root.geometry("380x330")
windowWidth = root.winfo_reqwidth()
windowHeight = root.winfo_reqheight()
positionRight = int(root.winfo_screenwidth() / 2 - windowWidth / 2)
positionDown = int(root.winfo_screenheight() / 2 - windowHeight / 2)
root.geometry("+{}+{}".format(positionRight, positionDown))
#-------------------------------------------------------------------------------------

# Introduction message that will introduce the user to the program.
# Adds a label to the window.
intro_slide = root
window1_message1 = "Welcome! \n To budget calculator"
window1_message2 = tk.Message(root, text=window1_message1, justify="center")
window1_message2.config(fg="Yellow", bg="Black", font=('times', 20, 'italic'))
window1_message2.pack()
#--------------------------------------------------------------------------------------

# Another label futher exsplaing the purpouse of the prgram.
# Adds a label to the window.
window1_message3 = "Here you can deposit or withdraw money and see your progress towards your goals, and insert your income and expenses and we will draw up a plan to solve your finance situation."
window1_message4 = tk.Message(root, text=window1_message3)
window1_message4.config(bg='white', relief="sunken", borderwidth=3, font=('times', 17))
window1_message4.pack()
#--------------------------------------------------------------------------------------

# A label asking the user if they are done reading the introduction message and if they are ready to start.
# Adds a label to the window.
window1_label = tk.Label(root, text="Are you ready to start?", font=("times", 15))
Example #20
0
 def create(self, **kwargs):
     return tkinter.Message(self.root, **kwargs)
Example #21
0
    def createWidgets(self):

        bgcolor = '#5A733A'
        bgcolor2nd = '#C6C8B3'
        top = self.winfo_toplevel()
        self.bg = bgcolor
        top.rowconfigure(0, weight=2)
        top.title('Autumn')

        top.columnconfigure(0, weight=2)
        self.rowconfigure(0, weight=2)
        self.columnconfigure(0, weight=2)
        titleFont = font.Font(family='Helvetica', size=72, slant='italic')

        #self.title = tk.Label(self,justify=tk.LEFT,padx=0,bg = bgcolor, height =2, width = 400,text ='Autumn',font=titleFont,bd=6,relief=tk.GROOVE)
        #self.title.grid(column = 0, row = 0, columnspan = 4,sticky=tk.N+tk.S+tk.E+tk.W)

        textFont = font.Font(family='Helvetica', size=14, slant='roman')
        textDesc = (
            "This is a rules engine for the trading card game Magic The Gathering, created by Richard Garfield, owned by Wizards of The Coast.\n"
            "Created by Jonathan Martinez, Computer Science and Applied Physics student at NJIT\n"
            "Source at https://gitlab.com/jonathanma/autumn")
        self.textMess = tk.Message(self,
                                   bg='#C5C5A1',
                                   font=textFont,
                                   width=1500,
                                   text=textDesc,
                                   bd=16,
                                   relief=tk.GROOVE)
        self.textMess.grid(column=0,
                           columnspan=5,
                           row=10,
                           sticky=tk.N + tk.S + tk.E + tk.W)

        self.banner = tk.Canvas(self, bg=bgcolor, height=400, width=1500, bd=0)
        self.banner.grid(column=0, row=0, columnspan=6)
        self.pilImage = Image.open("imgs/banner.jpg").resize((400, 400))
        self.Pimage = ImageTk.PhotoImage(self.pilImage)
        self.imagesprite = self.banner.create_image(1000,
                                                    0,
                                                    image=self.Pimage,
                                                    state=tk.NORMAL,
                                                    anchor=tk.NW)
        self.title = self.banner.create_text(0,
                                             0,
                                             width=400,
                                             text='Autumn',
                                             font=titleFont,
                                             anchor=tk.NW)

        self.dklistLabel = tk.Label(
            self,
            bg='#C5C5A1',
            font=textFont,
            text="Enter the file path to your decklist:",
            width=100,
            bd=8)
        self.dklistEntry = tk.Entry(self, font=textFont, width=100)
        self.confirmButton = tk.Button(self,
                                       bg='#B4E8B5',
                                       font=textFont,
                                       text='Enter',
                                       command=self.on_button,
                                       width=100,
                                       relief='raised')
        self.dklistLabel.grid(column=0,
                              row=1,
                              columnspan=1,
                              sticky=tk.N + tk.S + tk.E + tk.W)
        self.dklistEntry.grid(column=1,
                              row=1,
                              columnspan=6,
                              sticky=tk.N + tk.S + tk.E + tk.W)
        self.confirmButton.grid(column=1,
                                row=2,
                                columnspan=6,
                                sticky=tk.N + tk.S + tk.E + tk.W)
        self.errortxt = tk.StringVar()
        self.errorLabel = tk.Label(self,
                                   bg=bgcolor,
                                   font=textFont,
                                   textvariable=self.errortxt,
                                   fg='#ff0000')
        self.errorLabel.grid(row=2, column=0)
        self.startMatchButton = tk.Button(self,
                                          bg='#B4E8B5',
                                          font=textFont,
                                          text='Begin',
                                          command=self.start,
                                          width=100,
                                          relief='raised')
        self.startMatchButton.grid(column=1,
                                   row=3,
                                   sticky=tk.N + tk.S + tk.E + tk.W)
Example #22
0
    def how_it_works(self):

        graph_coloring = tk.Toplevel()

        def close_window():
            graph_coloring.destroy()

        graph_coloring.title("Welsh Powell Algorithm")
        graph_coloring.state('zoomed')
        graph_coloring.focus_force()

        self.main_container = tk.Frame(graph_coloring, background="light grey")
        self.main_container.pack(side="top", fill="both", expand=True)

        self.button_quit = tk.Button(self.main_container, text="Quit", bd=3, command=lambda: close_window())
        self.button_quit.pack(side="top", anchor="e", padx=10, pady=(10, 10))

        alg_lab = "Welsh Powell Algorithm"
        self.alg_text = tk.Message(self.main_container, text=alg_lab, width=500, font=24,
                                   relief="ridge", bd=20, borderwidth=3)
        self.alg_text.pack(side="top", anchor="center", fill="both", padx=10, pady=(0, 0))

        alg = 'Step 1: Find the degree of each vertex.\n' \
              'Step 2: List the vertices in descending order of degrees.\n' \
              'Step 3: Color the first vertex in the list.\n' \
              'Step 4: Go down the vertex list and color every vertex not connected\n' \
              "              "'to the colored vertex with the same color.\n' \
              'Step 5: Repeat step 3 and 4 with a new colour until all vertices are\n' \
              "              "'colored.'
        self.alg = tk.Message(self.main_container, text=alg, width=500, font=30,
                              background="light grey", justify="left", relief="ridge", bd=20, borderwidth=3)
        self.alg.pack(side="top", anchor="center", fill="both", padx=10, pady=(0, 0))

        self.demo_lab = tk.Label(self.main_container, text="Demo", width=500, font=18,
                                 relief="ridge", bd=20, borderwidth=3)
        self.demo_lab.pack(side="top", anchor="center", fill="both", padx=10, pady=(10, 0))

        # Canvas for the image
        self.left = tk.Frame(self.main_container)
        self.left.pack(side="left", anchor="center", fill="both", padx=10, pady=(0, 10), expand=True)

        self.graph_canvas = tk.Canvas(self.left)
        self.graph_canvas.pack(side="top", fill="both", expand=True)

        self.right = tk.Frame(self.main_container, background="white", relief="ridge", bd=20, borderwidth=3)
        self.right.pack(side="right", anchor="center", fill="both", padx=10, pady=(0, 10), expand=True)

        self.exp = tk.Frame(self.right, relief="ridge", bd=20, borderwidth=3)
        self.exp.pack(side="top", anchor="center", fill="both", expand=True)

        # ----------------------------------------------------------------------------------------------------
        step_1 = 'First, we find the degree of all vertices in the graph.\n' \
                 'This adjacency matrix shows the degree of each vertex in the graph.'
        self.step_1 = tk.Message(self.exp, text=step_1, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_2 = 'We find the vertex with the highest degree. In this case vertex 6 has the highest degree of 5.\n ' \
                 'Vertex 6 is colored in first.'
        self.step_2 = tk.Message(self.exp, text=step_2, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_3 = 'Next, all the vertices not adjacent to vertex 6 are colored in with the same color.'
        self.step_3 = tk.Message(self.exp, text=step_3, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_4 = 'Now we repeat step 2. Here, you notice several vertices have the same highest degree.\n' \
                 'In this case, we just pick the first one in the list.\n' \
                 'We color vertex 2 with a second color.'
        self.step_4 = tk.Message(self.exp, text=step_4, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_5 = 'Now we repeat step 3. Next, all the vertices not adjacent to vertex 2 are colored in with\n' \
                 'the same color.'
        self.step_5 = tk.Message(self.exp, text=step_5, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_6 = 'Again, we repeat step 2. Here, you notice several vertices have the same highest degree.\n' \
                 'Again, we just pick the first one in the list.\n' \
                 'We color vertex 3 with a third color.'
        self.step_6 = tk.Message(self.exp, text=step_6, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)

        step_7 = 'Again, we repeat step 3. Next, all the vertices not adjacent to vertex 3 are colored in with\n' \
                 'the same color.'
        self.step_7 = tk.Message(self.exp, text=step_7, width=500, font=30, justify="left", relief="ridge", bd=20,
                                 borderwidth=3)
        # ----------------------------------------------------------------------------------------------------
        self.steps = tk.Frame(self.exp, relief="groove", bd=20, borderwidth=3)
        self.steps.pack(side="bottom", anchor="s", fill="x", expand=True)

        # Button to show the images in an order
        self.button_step_one = tk.Button(self.steps, text="Step 1", bd=3, command=lambda: self.step_one())
        self.button_step_one.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_three = tk.Button(self.steps, text="Step 2", bd=3, command=lambda: self.step_two())
        self.button_step_three.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_four = tk.Button(self.steps, text="Step 3", bd=3, command=lambda: self.step_three())
        self.button_step_four.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_five = tk.Button(self.steps, text="Step 4", bd=3, command=lambda: self.step_four())
        self.button_step_five.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_six = tk.Button(self.steps, text="Step 5", bd=3, command=lambda: self.step_five())
        self.button_step_six.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_seven = tk.Button(self.steps, text="Step 6", bd=3, command=lambda: self.step_six())
        self.button_step_seven.pack(side="left", anchor="n", padx=10, expand=True)

        self.button_step_eight = tk.Button(self.steps, text="Step 7", bd=3, command=lambda: self.step_seven())
        self.button_step_eight.pack(side="left", anchor="n", padx=10, expand=True)

        self.adj_matrix_canvas = tk.Canvas(self.right, relief="ridge", bd=20, borderwidth=3)
        self.adj_matrix_canvas.pack(side="bottom", anchor="center", fill="both", expand=True)

        graph_coloring.mainloop()
Example #23
0
from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier(min_samples_split=7, random_state=111)
dtcFit = dtc.fit(X_train, y_train)
predDTC = dtc.predict(X_test)
accDTC = accuracy_score(y_test, predDTC)
cmDTC = confusion_matrix(y_test, predDTC)
model_assessment(y_test, predDTC)

text = [
    "Todays Voda numbers ending 7548 are selected to receive a $350 award. If you have a match please call 08712300220 quoting claim code 4041 standard rates app"
]
integers = vectorizer.transform(text)
p = dtc.predict(integers)[0]
find(p)

msgDTC = tk.Message(root, text=' ', aspect=500)
msgDTC.place(x=630, y=250)


def retrieve_DTC():
    inputvalDTC = textBox.get("1.0", "end-1c")
    integersDTC = vectorizer.transform([inputvalDTC])
    p = dtc.predict(integersDTC)[0]
    messageDTC = FIND(p)
    msgDTC.configure(text=messageDTC)
    msgDTC.config(bg='lightgreen', font=('times', 15, 'italic'))
    print(messageDTC)


#RandomForestClassifier
from sklearn.ensemble import RandomForestClassifier
btn = Button(top, text='Open File', command=lambda: open_file())

# Re program


def callback():
    if mb.askyesno('Verify', 'Really want to Re-Program ?'):
        btn.grid(row=1, column=3)
    else:
        mb.showinfo('No', 'Re-Program has been cancelled')


tk.Button(text='Do you want to Re Program this Simple Calculator?',
          command=callback).grid(row=8, column=4)
tk.mainloop()

#mainloop()

top.mainloop()

# Start your coding here...

import tkinter as tk

master = tk.Tk()
whatever_you_do = "Whatever you do will be insignificant, but it is very important that you do it.\n(Wajeeh)"
msg = tk.Message(master, text=whatever_you_do)
msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
tk.mainloop()
Example #25
0
    def __menu__():
        root.resizable(False, False)

        main_frame = ttk.Frame(root)
        main_frame.grid(column=0, row=0, padx=10, pady=10)

        rsagen_frame = ttk.LabelFrame(root, text="RSA generator")
        rsagen_frame.grid(column=0, row=1, padx=10, pady=10, sticky=tk.W)

        decision_frame = ttk.LabelFrame(root,
                                        text="Facts about this sytem",
                                        width=100)
        decision_frame.grid(column=0, row=2, padx=10, pady=10, sticky=tk.W)

        greeting = tk.Message(main_frame,
                              text="Welcome to the digital envelope system...")
        greeting.config(fg='blue', font=('times', 16, 'italic'), width=500)
        greeting.grid(column=1, row=0, padx=15, pady=20, sticky=tk.W)

        advice = "A pair of RSA keys are needed. Do you have it? "
        advice_lab = ttk.Label(rsagen_frame, text=advice)
        fontsize_13(advice_lab)
        advice_lab.grid(column=0,
                        row=0,
                        padx=30,
                        pady=20,
                        columnspan=2,
                        sticky=tk.W)

        rsa_gene_button = ttk.Button(rsagen_frame,
                                     width=18,
                                     text="RSA Key Generator",
                                     command=rsagenerator)
        rsa_gene_button.grid(column=2,
                             row=0,
                             padx=5,
                             pady=20,
                             ipadx=10,
                             ipady=15,
                             sticky=tk.E)

        key_length = ttk.Label(rsagen_frame,
                               text="Choose the length of RSA key: ")
        fontsize_13(key_length)
        key_length.grid(column=0, row=1, padx=10, pady=20)

        key_choice = ttk.Combobox(rsagen_frame,
                                  width=10,
                                  height=10,
                                  textvariable=rsa_keylen,
                                  state="readonly")
        key_choice['values'] = (1024, 2048, 4096)
        key_choice.grid(column=2,
                        row=1,
                        ipadx=8,
                        ipady=5,
                        padx=30,
                        pady=20,
                        sticky=tk.W)
        key_choice.current(0)

        ins = "1.   To use the system, first you need to have a pair of RSA keys called public key and private key.\n      If you don’t have one, generate it from the RSA key generator. You don’t need to generate it\n      frequently whenever you use the system and can reuse the previous RSA keys."
        fact1 = ttk.Label(decision_frame, text=ins)
        fontsize_13(fact1)
        fact1.grid(column=0, row=0, pady=10, columnspan=3, sticky=tk.W)
        ins = "2.   Second, you need to exchange the public key with the person you want to communicate with."
        fact2 = ttk.Label(decision_frame, text=ins)
        fontsize_13(fact2)
        fact2.grid(column=0, row=1, pady=10, columnspan=3, sticky=tk.W)
        ins = "3.   Third, you must keep your private key secret. Don’t reveal it to anyone."
        fact3 = ttk.Label(decision_frame, text=ins)
        fontsize_13(fact3)
        fact3.grid(column=0, row=2, pady=10, columnspan=3, sticky=tk.W)
        ins = "4.   The RSA key used in this system have a specific format. If you use the other key formats\n      generated from other system, you will got some kind of error."
        fact4 = ttk.Label(decision_frame, text=ins)
        fontsize_13(fact4)
        fact4.grid(column=0, row=3, pady=10, columnspan=3, sticky=tk.W)
        ins = '5.   "Create Digital Envelope" button is for securing your data and "Opening Digital Envelope"\n      button is for decrypting the data sent from others. '
        fact5 = ttk.Label(decision_frame, text=ins)
        fontsize_13(fact5)
        fact5.grid(column=0, row=4, pady=10, columnspan=3, sticky=tk.W)

        create_enve = ttk.Button(decision_frame,
                                 text="Create Digital Envelope",
                                 command=_create)
        create_enve.grid(column=0, row=5, padx=10, ipadx=25, pady=40, ipady=15)

        open_enve = ttk.Button(decision_frame,
                               text="Open Digital Envelope",
                               command=_open)
        open_enve.grid(column=1,
                       row=5,
                       pady=40,
                       ipadx=25,
                       ipady=15,
                       sticky=tk.E)
Example #26
0
    print("menu2 button2 was pressed")


#T# create a menu button as part of the menubar with Menu()
menuBar1 = tkinter.Menu(topW1)
menuOptions2 = tkinter.Menu(menuBar1)
menuOptions2.add_command(label="command1", command=m2Press1)
menuOptions2.add_separator()
menuOptions2.add_command(label="command2", command=m2Press2)

#T# add a menu's options to the menubar with add_cascade()
menuBar1.add_cascade(label="menu opts name", menu=menuOptions2)

#T# create a message box with Message()
messg1 = tkinter.Message(topW1,
                         text="Hello\nThis message text appears in\
                the window for the current program in execution")

radioVar = tkinter.StringVar()
#T# create radio buttons with Radiobutton()
radioB1 = tkinter.Radiobutton(topW1,
                              text="radioOption1",
                              value="Op1",
                              variable=radioVar)
radioB2 = tkinter.Radiobutton(topW1,
                              text="radioOption2",
                              value="Op2",
                              variable=radioVar)
radioB3 = tkinter.Radiobutton(topW1,
                              text="radioOption3",
                              value="Op3",
Example #27
0
    def _check_accuracy():
        global accurate_form
        accurate_form = Toplevel(root)
        accurate_form.resizable(False, False)
        accurate_form.iconbitmap('email.ico')
        accurate_form.title('Checking Accuracy')
        #accurate_form.lift()
        accurate_form.attributes("-topmost", True)

        title = "Checking accuracy of the file"
        manual_mes = tk.Message(accurate_form, text=title, width=700)
        manual_mes.config(fg='blue', font=('times', 16, 'italic'))
        manual_mes.grid(column=1,
                        row=0,
                        padx=4,
                        pady=12,
                        sticky=tk.W,
                        columnspan=7)

        label1 = ttk.Label(accurate_form, text="Enter the original file: ")
        fontsize_13(label1)
        label1.grid(column=0, row=1, padx=8, pady=8)
        original_file = ttk.Entry(accurate_form,
                                  width=40,
                                  font=fontsize_12,
                                  textvariable=origin_txt)
        original_file.grid(column=1, row=1, padx=8, pady=8)
        browse_origin_file = ttk.Button(accurate_form,
                                        text="..",
                                        command=browse_origin_txt,
                                        width=3)
        browse_origin_file.grid(column=2, row=1, padx=8, pady=8)

        label2 = ttk.Label(accurate_form, text="Enter the decrypted file: ")
        fontsize_13(label2)
        label2.grid(column=0, row=2, padx=8, pady=8)
        decrypted_file = ttk.Entry(accurate_form,
                                   width=40,
                                   font=fontsize_12,
                                   textvariable=decrypted_txt)
        decrypted_file.grid(column=1, row=2, padx=8, pady=8)
        browse_decrypted_file = ttk.Button(accurate_form,
                                           text="..",
                                           command=browse_decrypted_txt,
                                           width=3)
        browse_decrypted_file.grid(column=2, row=2, padx=8, pady=8)

        chk_accu_button = ttk.Button(accurate_form,
                                     text="Check it",
                                     command=check_accuracy)
        chk_accu_button.grid(column=1,
                             row=3,
                             padx=8,
                             pady=(20, 8),
                             sticky=tk.W)
        close_button = ttk.Button(accurate_form,
                                  text="Back",
                                  command=close_accuracy)
        close_button.grid(column=1, row=3, padx=8, pady=(20, 8), sticky=tk.E)

        global result_label
        result_label = ttk.Label(accurate_form, text='')
        fontsize_13(result_label)
        result_label.grid(column=1, row=4, padx=10, pady=10)
Example #28
0
#Date variables with help from URL: https://stackoverflow.com/questions/1506901/cleanest-and-most-pythonic-way-to-get-tomorrows-date

day_one = datetime.date.today()
day_two = datetime.date.today() + datetime.timedelta(days=1)
day_three = datetime.date.today() + datetime.timedelta(days=2)
day_four = datetime.date.today() + datetime.timedelta(days=3)
day_five = datetime.date.today() + datetime.timedelta(days=4)
day_six = datetime.date.today() + datetime.timedelta(days=5)
day_seven = datetime.date.today() + datetime.timedelta(days=6)

if __name__ == '__main__':

    window = tkinter.Tk()

    welcome_message = tkinter.Message(
        text=
        "\nWelcome to Movie Showtimes!\nPowered by the Internet Movie Database \n (https://www.imdb.com/) \n"
    )

    zip_label_prompt = tkinter.Label(
        text="Please enter a 5-digit postal code (US only): ")
    z_entry = tkinter.StringVar(value="Enter Here")
    zip_entry = tkinter.Entry(textvariable=z_entry)

    date_radio_label = tkinter.Label(text="\n\nPlease select a show date: ")
    date_radio_value = tkinter.StringVar(value=day_one.strftime("%Y-%m-%d"))

    date_radio_a = tkinter.Radiobutton(text=day_one.strftime("%B %d, %Y "),
                                       value=day_one.strftime("%Y-%m-%d"),
                                       variable=date_radio_value)
    date_radio_b = tkinter.Radiobutton(text=day_two.strftime("%B %d, %Y "),
                                       value=day_two.strftime("%Y-%m-%d"),
Example #29
0
import tkinter

window=tkinter.Tk()
window.title("14 message")
window.geometry("640x400+100+100")
window.resizable(False, False)

message=tkinter.Message(window, text="메세지입니다.", width=100, relief="solid")
message.pack()

window.mainloop()
    def __init__(self, master):

        master.title("Die magischen Zahlenkarten")

        # Oberer Teil des GUIs. Mit Titel und Beschreibungen
        frame1 = tk.Frame(master)
        frame1.pack()

        frame2 = tk.Frame(master)
        frame2.pack()

        my_title = "Magische Zahlenkarten"
        my_info = "Beschreibung: \n\
Merke dir eine Zahl zwischen 1 und 63. \
Klicke auf jede Karte, auf welcher \
deine gemerkte Zahl vorkommt. Sind \
alle Karten markiert (rot angefärbt) auf welchen deine Zahl vorkommt, \
so klicke weiter unten auf Los!"

        the_title = tk.Message(frame1, text=my_title)
        the_title.config(width=340, font=("Times", "24", "bold italic"))
        the_title.grid(row=0)

        beschreibung = tk.Message(frame2, text=my_info)
        beschreibung.config(width=300)
        beschreibung.grid(row=0, column=0, rowspan=2, padx=60)

        my_info2 = 'Wenn du alle Felder markiert hast, \
auf welchen sich deine gewünschte Zahl befindet, \
dann klicke auf "Los!"'

        beschreibung2 = tk.Message(frame2, text=my_info2, width=200)
        beschreibung2.grid(row=0, column=1, columnspan=2, padx=20)

        tk.Button(frame2, text="Los!",
                  command=self.action_magic_guess).grid(row=1,
                                                        column=1,
                                                        sticky=tk.E)
        tk.Button(frame2, text="Exit", command=master.quit).grid(row=1,
                                                                 column=2,
                                                                 sticky=tk.W)

        self.txt_magic_guess = tk.Message(frame2,
                                          width=500,
                                          font=("Times", "16", "bold italic"))
        self.txt_magic_guess.grid(row=2, column=0, columnspan=3)

        # Erstellen der Bilder-Button
        self.frame_karten = tk.Frame(master)
        self.frame_karten.pack()

        self.karten_list = []
        self.button_list = []
        self.image_list = []

        pic_dir = "./pics/"

        for i in range(2):
            for j in range(3):
                glob_nr = 3 * i + j
                passiv_path = pic_dir + "b" + str(2**glob_nr) + ".gif"
                active_path = pic_dir + "b" + str(2**glob_nr) + str(
                    2**glob_nr) + ".gif"
                self.karten_list.append(
                    Karte(active_path, passiv_path, glob_nr))
                self.image_list.append(tk.PhotoImage(file=passiv_path))

                self.button_list.append(
                    tk.Button(self.frame_karten,
                              image=self.image_list[glob_nr],
                              command=lambda glob_nr=glob_nr: self.
                              action_change_button(glob_nr)))
                self.button_list[glob_nr].grid(row=i, column=j)

        # Menu erstellen
        menubar = tk.Menu(master)
        filemenu = tk.Menu(menubar, tearoff=0)
        filemenu.add_command(label="Los!", command=self.action_magic_guess)
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=master.quit)
        menubar.add_cascade(label="File", menu=filemenu)

        helpmenu = tk.Menu(menubar, tearoff=0)
        helpmenu.add_command(label="Info!",
                             command=self.action_get_info_dialog)
        menubar.add_cascade(label="Help", menu=helpmenu)

        master.config(menu=menubar)