Ejemplo n.º 1
0
def train(mode: int, dt, nb_repetitions=2, subtitle=""):
    """ Display chords every dt seconds. Once all the chords have been played once, another round can begin."""

    my_list = name_to_content(mode_to_name(mode))
    elements_already_chosen = []
    n = len(my_list)

    for i in range(nb_repetitions * n):

        if len(elements_already_chosen) == n:
            elements_already_chosen = []

        el = choice(my_list)

        # Check that the element has not been played already in the current cycle.
        while el in elements_already_chosen:
            el = choice(my_list)

        # Update list of already played elements
        elements_already_chosen.append(el)

        # Display
        root = Tk()
        root.attributes('-fullscreen', True)
        root.after(floor(dt * 1000), lambda: root.destroy())
        msg = Message(root, text=el)
        msg.config(font=('times', 100, 'italic bold underline'))
        msg.pack()

        # Optional message
        msg1 = Message(root, text=subtitle)
        msg1.config(font=('times', 50))
        msg1.pack()

        root.mainloop()
Ejemplo n.º 2
0
    def addRealmRow(self, realm):
        if not realm:
            return

        index = len(self.savedRealmName)
        name = realm['name']
        address = realm['address']

        self.savedRealmName.append(
            Message(self.savedRealmsFrame, text=name, width=250))
        self.savedRealmName[index].grid(column=0, row=index + 1)

        self.savedRealmAddress.append(
            Message(self.savedRealmsFrame, text=address, width=250))
        self.savedRealmAddress[index].grid(column=1, row=index + 1)

        self.selectRealmButton.append(
            Button(self.savedRealmsFrame,
                   text='SET',
                   command=lambda rlm=realm: self.setActiveRealm(rlm)))
        self.selectRealmButton[index].grid(column=2, row=index + 1)

        self.removeRealmButton.append(
            Button(self.savedRealmsFrame,
                   text='REMOVE',
                   command=lambda idx=index: self.removeSavedRealm(idx)))

        self.removeRealmButton[index].grid(column=3, row=index + 1)
        self.totalRealmItems = index + 1
Ejemplo n.º 3
0
    def __init_gui(self):
        self.soal_label = Message(
            self.window,
            text=
            "Tunggu! Anda belum terkoneksi! Masukkan informasi mengenai sesi dan nama anda!",
            width=360)
        self.soal_label.pack()

        self.pilihan_label = Message(self.window,
                                     text="",
                                     anchor="w",
                                     width=360)
        self.pilihan_label.pack()

        self.pengumuman_label = Message(self.window,
                                        text="",
                                        anchor="w",
                                        width=360)
        self.pengumuman_label.pack()

        self.grid = Frame(self.window, width=360)
        self.grid.pack()

        jawaban_label = Label(self.grid, text="Jawaban anda: ")

        self.jawaban_entry = Entry(self.grid, state="disabled")
        self.sumbit_jawaban = Button(self.grid, text="Jawab", state="disabled")

        jawaban_label.grid(row=0, column=0)
        self.jawaban_entry.grid(row=0, column=1)
        self.sumbit_jawaban.grid(row=0, column=2)
Ejemplo n.º 4
0
Archivo: ui.py Proyecto: hayj/Annotator
 def initUI(self):
     self.master.title("Annotator")
     # self.grid(row=0, column=0, sticky='news')
     # self.rowconfigure(0, weight=1)
     # self.columnconfigure(0, weight=1)
     self.pack(fill=BOTH, expand=True)
     self.columnconfigure(0, weight=1)
     self.columnconfigure(11, pad=10)
     for i in range(10):
         self.rowconfigure(i, weight=1)
     # for i in range(20):
     # 	self.columnconfigure(i, weight=1)
     # Title:
     row = 0
     titleMessage = Message(self,
                            text="Annotator",
                            **self.headMessagesOption)
     titleMessage.grid(row=row, column=11, sticky='ewn')
     row += 1
     # Description:
     w1 = Message(self,
                  text=self.toolDescription,
                  width=200,
                  font='Arial 8')
     w1.grid(sticky="n", row=row, column=11, pady=4)
     row += 1
     # Task description:
     if self.taskDescription is not None:
         titleMessage = Message(self,
                                text="Task description",
                                **self.headMessagesOption)
         titleMessage.grid(row=row, column=11, sticky='ewn')
         row += 1
         w1 = Message(self,
                      text=self.taskDescription,
                      width=200,
                      font='Arial 8')
         w1.grid(sticky="n", row=row, column=11, pady=4)
         row += 1
     # Labels:
     self.labelFrameRow = row
     row += 1
     # Control head:
     browsingMessage = Message(self,
                               text="Browsing",
                               **self.headMessagesOption)
     browsingMessage.grid(row=row, column=11, sticky='ewn')
     row += 1
     # We make buttons:
     subFrame = Frame(self)
     subFrame.columnconfigure(0, weight=1)
     subFrame.columnconfigure(1, weight=1)
     subFrame.rowconfigure(0, weight=1)
     subFrame.grid(row=row, column=11, sticky="new")
     previousButton = Button(subFrame, text="<<", command=self.left)
     previousButton.grid(row=0, column=0, sticky="new")
     nextButton = Button(subFrame, text=">>", command=self.right)
     nextButton.grid(row=0, column=1, sticky="new")
     row += 1
Ejemplo n.º 5
0
    def load_page(self):
        image = Image.open(self.path)
        # get the text and image data from the current page:
        currentpage = self.tutdata[self._currentindex]
        # image = resize_img(image)
        photo = ImageTk.PhotoImage(image)
        # cleanup the last page shown:
        if self._image:
            self._image.grid_forget()
        if self._text:
            self._text.grid_forget()
        if self._titletext:
            self._titletext.grid_forget()

        # if the image is a gif:
        if '.gif' in self.path:
            self._image = GifPlayer(self, borderwidth=2, relief="solid")
            # self.image.image = photo  # keep a reference!
            self._image.grid(row=0, column=0, columnspan=205, rowspan=205)
            self._image.load(self.path)
        # if it's just a still image:
        else:
            self._image = Label(self,
                                image=photo,
                                borderwidth=2,
                                relief="solid")
            self._image.image = photo  # keep a reference!
            self._image.grid(row=0, column=0, columnspan=205, rowspan=205)
        # grab the text:
        title = currentpage['title']
        text = currentpage['text']
        self._titletext = Message(self,
                                  text=title,
                                  font=self.h1,
                                  width=500,
                                  justify='center')
        self._text = Message(self,
                             text=text,
                             font=self.h2,
                             width=500,
                             justify='center')
        # if this is the first or last page, we want the text below the image:
        if "Welcome" in self.path:

            self._titletext.grid(row=210, column=0, columnspan=205, pady=20)
            self._text.grid(row=215, column=0, columnspan=205, pady=20)
        # otherwise, we want it to the side:
        else:
            self._titletext.grid(row=5,
                                 column=300,
                                 columnspan=205,
                                 pady=60,
                                 padx=20)
            self._text.grid(row=10,
                            column=300,
                            columnspan=205,
                            pady=60,
                            padx=20)
Ejemplo n.º 6
0
	def checkSettingsBeforePrint(self):

		if self.selectedPrinter.get() != '' and self.PDFs != None :
			printingThread = threading.Thread(target=self.printFiles)
			printingThread.start()
		else:
			if self.selectedPrinter.get() == '':
				posx  = 500
				posy  = 400
				sizex = 500
				sizey = 100
				top = Toplevel()
				top.grid_rowconfigure(0,weigh=1)
				top.grid_columnconfigure(0, weight=1)
				top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy))
				top.title("Printer not set")
				msg = Message(top, text="Set the default printer in\nPrinter Settings.",width=200, pady=10)
				msg.grid(row=0, column=0,columnspan=5)
				button = Button(top,text="Ok", command=top.destroy)
				button.grid(row=1, column=0)
				self.current_window = top
				if self.runningInFrozen:
					top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico")
				else:
					top.iconbitmap("emblem_print.ico")
				top.focus_force()
				top.bind("<FocusOut>", self.Alarm)
				return None
			elif self.PDFs == None:
				posx  = 500
				posy  = 400
				sizex = 500
				sizey = 100
				top = Toplevel()
				top.grid_rowconfigure(0,weigh=1)
				top.grid_columnconfigure(0, weight=1)
				top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy))
				top.title("No file loaded")
				msg = Message(top, text="Browse for a file before printing.",width=200, pady=10)
				msg.grid(row=0, column=0,columnspan=5)
				button = Button(top,text="Ok", command=top.destroy)
				button.grid(row=1, column=0)
				self.current_window = top
				if self.runningInFrozen:
					top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico")
				else:
					top.iconbitmap("emblem_print.ico")
				top.focus_force()
				top.bind("<FocusOut>", self.Alarm)
				return None
Ejemplo n.º 7
0
    def guiThread(self):
        root = Tk()
        pane = Frame(root) 
        pane.pack(fill = BOTH, expand = True) 
        exit_button = Button(pane, text='Exit Program', command=root.destroy)
        exit_button.pack(side = LEFT, expand = True, fill = BOTH)
        msg = Message(root, text="TEST TEST TEST")
        msg.config(font=('Consolas', 10, ''))
        msg.pack()

        def updateImage():
            #print("in updateImage()")
            if not self.queueGUI.empty():
                while not self.queueGUI.empty():
                    imgText = self.queueGUI.get()
                #print("set Text to {}".format(imgText))
                msg.configure(text=imgText)
                #if len(self.queueGUI.queue):
                    #print("clear queue")
                    #self.queueGUI.queue.clear()
            #else:
                #print("queue empty")
            root.after(100, updateImage)

        root.after(100, updateImage)
        root.mainloop()
Ejemplo n.º 8
0
    def run_top_level_windows(self):
        """
        Creates top level window which describes the application's function to the user.
        :return: None
        """
        self.root.withdraw()
        top = Toplevel()
        top.title("About image processing application.")
        message = Message(
            top,
            text=
            "This application is used to process image files.  Begin by hitting Open Image "
            "under Options on the title bar and entering the name of a file stored in the "
            "images folder.",
            width=300)
        message.pack()

        def button_hit():
            """
            Actions for when the continue button on the top level window is hit.
            :return: None
            """
            top.destroy()
            self.root.deiconify()
            w, h = self.root.winfo_screenwidth(), self.root.winfo_screenheight(
            )
            self.root.geometry("%dx%d+0+0" % (w, h))

        button = Button(top, text='continue', command=button_hit)
        button.pack()
Ejemplo n.º 9
0
    def error(self, event=None):
        ''' Displays an error page if a user did not provide all of the required information. '''
        self.l_page.pack_forget()
        self.l_page.destroy()
        self.e_page = Frame(self.master, height=1080, width=1920, bg=self.bg)
        self.e_page.pack()
        self.e_page.focus_set()
        self.e_page.bind("<Return>", self.login_page)
        self.e_page.bind("<Escape>", self.close)


        self.err_title = Label(self.e_page, text="Error: Missing Information", font=("sans serif", 50),
                               bg=self.bg, fg=self.fg, pady=10)
        self.err_title.pack()
        self.err_mss = Message(self.e_page, text="Your submission was missing some data. All fields are rquired.\nPlease return to fill out all fields.",
                               font=("sans serif", 20), width=1900, justify=CENTER, fg=self.fg, bg=self.bg, pady=10)
        self.err_mss.pack()


        self.buttons4 = Frame(self.e_page, width=500, bg=self.bg)
        self.buttons4.pack()
        self.ret = Button(self.buttons4, text="Return", bg="#64e764", fg="#654321", pady=5,
                          activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.login_page)
        self.ret.grid(row=0, column=0)
        self.cancel = Button(self.buttons4, text="Cancel", bg="#64e764", fg="#654321", pady=5,
                             activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.master.quit)
        self.cancel.grid(row=0, column=1)
Ejemplo n.º 10
0
    def showProcessInfoWindow(cls, destroyTime, title, message):

        infoWindow = Toplevel()
        infoWindow.title(title)
        infoWindow.geometry("%dx%d+%d+%d" % (300, 100, 100, 100))
        Message(infoWindow, text=message, padx=20, pady=20, width=200).pack()
        infoWindow.after(destroyTime, infoWindow.destroy)
Ejemplo n.º 11
0
 def __init__(self,
              master,
              text='',
              buttons=[],
              default=None,
              cancel=None,
              title=None,
              class_=None):
     if class_:
         self.root = Toplevel(master, class_=class_)
     else:
         self.root = Toplevel(master)
     if title:
         self.root.title(title)
         self.root.iconname(title)
     self.message = Message(self.root, text=text, aspect=400)
     self.message.pack(expand=1, fill=BOTH)
     self.frame = Frame(self.root)
     self.frame.pack()
     self.num = default
     self.cancel = cancel
     self.default = default
     self.root.bind('<Return>', self.return_event)
     self.root.bind('<Escape>', self.wm_delete_window)
     for num in range(len(buttons)):
         s = buttons[num]
         f = Frame(self.frame)
         b = ttk.Button(f,
                        text=s,
                        command=(lambda self=self, num=num: self.done(num)))
         b.pack(side=LEFT, fill=BOTH)
         f.pack(side=TOP, fill=BOTH)
     self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window)
     self._set_transient(master)
Ejemplo n.º 12
0
def update(frame_number):
    fig.clear()
    global carry_on
    matplotlib.pyplot.xlim(0, maxEnv - 1)
    matplotlib.pyplot.ylim(0, maxEnv - 1)
    matplotlib.pyplot.imshow(environment)
    matplotlib.pyplot.title("Iteration:" + str(frame_number) + "/" +
                            str(num_of_iterations))
    for j in range(num_of_iterations):
        print(agents[0].x, agents[0].y)
        for i in range(num_of_agents):
            agents[i].move()
            #Agent eats values
            agents[i].eat()
            #print("Eating")
            if agents[i].store > 100:
                #Greedy agents are sick if they eat more than 100 units
                agents[i].sick()
                #print ("Being sick")
    for i in range(num_of_agents):
        # agent is half full
        if agents[i].store > 50:
            carry_on = False
        else:
            carry_on = True
        print(carry_on)
    if carry_on == False:
        w = Message(root, anchor="n", text="All sheep are at least half full")
        w.pack()
        print("All sheep are at least half full")
    for i in range(num_of_agents):
        matplotlib.pyplot.scatter(agents[i].x, agents[i].y)
Ejemplo n.º 13
0
def timed_messagebox(title, message):
    messagebox = Toplevel()
    messagebox.title(title)
    m = Message(messagebox, text=message, padx=100, pady=100)
    m.config(font=('TkDefaultFont', 20))
    m.pack()
    messagebox.after(3000, messagebox.destroy)
Ejemplo n.º 14
0
 def init_page(self):
     Label(self, text="LOGO").pack(fill="both")
     Label(self, text=self.app_name).pack()
     Label(self, text=self.app_version).pack()
     Label(self, text=self.app_url).pack()
     Label(self, text=self.app_).pack()
     Message(self, text=self.app_desc).pack()
Ejemplo n.º 15
0
def update_server(frame, server_key):
    show_server = Message(frame,
                          text=server_key,
                          aspect=2000,
                          anchor=W,
                          relief=SUNKEN)
    show_server.place(x=80, y=30, width=215, height=30)
Ejemplo n.º 16
0
 def destroy():
     editbook.destroy()
     updatebook.destroy()
     master = Tk()
     w = Message(master, text="Records Have Been Updated!!!")
     w.pack()
     mainloop()
Ejemplo n.º 17
0
    def __init__(self):
        ''' Iniciador da classe
        '''
        super(Window, self).__init__()
        self.title('Conversor do PAD')
        # self.geometry('{width}x{height}'.format(width=800, height=400))

        # Texto introdutório
        text_intro = '''
Conversor do PAD é um conversor de layout que converte os dados gerados pelos sistemas informatizados com a finalidade de serem importados pelo SIAPC/PAD do TCE/RS.

Basicamente, o programa pega os dados e os converte para um formato diferente.
        '''
        self.intro = Message(self,
                             text=text_intro,
                             justify=LEFT,
                             anchor=N + W,
                             padx=10,
                             pady=10,
                             width=700)
        self.intro.pack(fill=X)

        # Formulário com os campos de configuração
        form = Frame(self, padx=10, pady=10)
        form.pack()

        self._build_source_field(form)  # Seletor do diretório de origem
        self._build_output_field(form)  # Seletor do diretório de destino
        self._build_output_format(form)  # Seleção de formatos de saída
        self._build_output_name(form)  # Nome do arquivo de saída
        self._build_progress_bar(form)  # Barra de progresso
        self._build_start_button(form)  # Botão de conversão
        self._build_info_box(form)  # Caixa de informações
        self._build_status_bar()  # Barra de status
Ejemplo n.º 18
0
    def _message_prompt(self, title, text, width=400, height=300, normal=True):
        top = Toplevel(self.root)
        top.geometry("%dx%d%+d%+d" % (width, height, 250, 125))
        top.title(title)
        help_message = text
        msg = Message(top,
                      text=help_message,
                      justify='left',
                      width=width - 100)
        msg.place(relx=0.5, rely=0.4, anchor='center')
        if normal:
            Button(top, text='Dismiss',
                   command=top.destroy).place(relx=0.5,
                                              rely=0.9,
                                              anchor='center')
        else:

            def couple_func():
                top.destroy()
                self.result_dir = filedialog.askdirectory(
                    title='Select a directory to save results ...',
                    mustexist=True)
                self.count_launch()

            Button(top, text='Continue',
                   command=couple_func).place(relx=0.5,
                                              rely=0.8,
                                              anchor='center')
            Button(top, text='Cancel',
                   command=top.destroy).place(relx=0.5,
                                              rely=0.9,
                                              anchor='center')
Ejemplo n.º 19
0
def codeCreateUrgency():

    # Interfaz para seleccionar el archivo Excel que contienen los datos necesarios para la creación del cambio
    root.filename = filedialog.askopenfilename(
        filetypes=[("Excel files", ".xlsx .xls .xlsm")])

    # Guarda los respectivos datos para la creación del CH
    dataCH = ReadDataInfo(root.filename)
    tasks, countRB = ReadDataSub(root.filename)

    # crear el cambio
    estadoCH, urlCH = CreationCHU(dataCH, tasks, countRB)

    # Devuelve el resultado de la ejecución del CH
    returnStatus.set(estadoCH)
    returnURL.set(urlCH)

    # Mensajes en la pantalla según el return de la funcion CreationCH
    resultStatus = Message(frame, textvariable=returnStatus, bg="#f8f8fb", fg="#c65185", font=(
        "Alata", 9), width=210, justify="center", cursor="center_ptr")
    resultStatus.place(x=108, y=150)

    resultURL = Entry(frame, textvariable=returnURL, bg="#f8f8fb",
                      fg="#3d3132", font=("Alata", 7), width=52, justify="center")
    resultURL.place(x=83, y=180)
 def make_Message_2(self, frame):
     self.Message_2 = Message(
         frame,
         text=
         "Each widget will still need to set the sticky property (e.g. ns, ew, nsew)",
         width="400")
     self.Message_2.grid(row=7, column=0, columnspan="6")
Ejemplo n.º 21
0
    def __init__(self, master):
        self.master = master
        master.title("Optimus Manager Gui")

        self.warning_label = Label(
            master,
            text=
            "changing graphics configuration requires this to be run as root!")
        self.warning_label.grid(row=2, column=1, columnspan=3)

        self.status_output = Message(master, text="getting status...")
        self.status_output.grid(columnspan=2, row=1, column=1)

        self.intel_button = Button(master,
                                   text="use intel graphics",
                                   command=lambda: self.swapGraphics("intel"))
        self.intel_button.grid(row=3, column=1)

        self.hybrid_button = Button(
            master,
            text="use hybrid graphics",
            command=lambda: self.swapGraphics("hybrid"))
        self.hybrid_button.grid(row=3, column=2)

        self.nvidia_button = Button(
            master,
            text="use nvidia graphics",
            command=lambda: self.swapGraphics("nvidia"))
        self.nvidia_button.grid(row=3, column=3)

        self.quit_button = Button(master, text="quit", command=master.quit)
        self.quit_button.grid(row=4, column=3)

        self.updateStatus()
 def make_Message_3(self, frame):
     self.Message_3 = Message(
         frame,
         width="400",
         text="Use numbered \"Quick-Set\" buttons or set Spinbox and hit OK."
     )
     self.Message_3.grid(row=2, column=0, columnspan="6")
Ejemplo n.º 23
0
    def print_classes(self):
        rowOffset = 0
        label = tk.Label(self.frm, text="Grain Classes:")
        label.grid(row=rowOffset, column=1)
        for k in sorted(self.classesDict.keys()):
            rowOffset += 1
            classDescr = ""
            for grain in self.classesDict[k]:
                classDescr = classDescr + "\n" + grain
            classMsg = Message(self.frm, text=classDescr, width=100)
            classMsg.grid(column=1, row=rowOffset)

        #print("GRAIN_COLS:")
        #print(GRAIN_COLS)

        b_accept = tk.Button(self.frm, text='Accept')
        b_accept['command'] = self.accept
        b_accept.grid(row=rowOffset + 1, column=1)

        if len(self.remaining_grains) == 0:
            b_accept.config(state=NORMAL)
            self.b_remaining.config(state=DISABLED)
            self.b_add.config(state=DISABLED)
        else:
            b_accept.config(state=DISABLED)

        if len(self.classesDict) == 0:
            self.b_reset.config(state=DISABLED)
        else:
            self.b_reset.config(state=NORMAL)
 def make_Message_1(self, frame):
     self.Message_1 = Message(
         frame,
         text=
         "Weight affects how widgets expand and contract on window resize.",
         width="400")
     self.Message_1.grid(row=6, column=0, columnspan="6")
Ejemplo n.º 25
0
 def __init__(self, wdw, sols):
     """
     Stores the list of solutions in sols
     and defines the layout of the GUI.
     """
     wdw.title('solutions scroller')
     self.sols = sols
     self.cursor = 0
     self.lbl = Label(wdw, text="solution : ")
     self.lbl.grid(row=0, column=0, sticky=E)
     self.ent = Entry(wdw)
     self.ent.grid(row=0, column=1, stick=W)
     self.ent.insert(INSERT, "0 of %d" % len(sols))
     self.myft = Font(family="Courier New", size=12, weight="normal")
     self.mlen = self.myft.measure("M")
     lines = sols[0].split('\n')
     self.width = max([len(line) for line in lines])
     self.display = StringVar()
     self.display.set(self.sols[0])
     self.mess = Message(wdw, textvariable=self.display, \
         font=self.myft, width=self.width*self.mlen, background='white')
     self.mess.grid(row=1, column=0, columnspan=2)
     self.btnext = Button(wdw, command=self.next, text='next')
     self.btnext.grid(row=2, column=1, sticky=W + E)
     self.btprev = Button(wdw, command=self.previous, text='previous')
     self.btprev.grid(row=2, column=0, sticky=W + E)
Ejemplo n.º 26
0
    def __init__(self):

        # create the window
        window = Tk()
        window.title("Widget Demo")

        # create the first frame
        frame1 = Frame(window)
        frame1.pack()

        # create variables for buttons and create the buttons
        self.v1 = IntVar()
        cbtBold = Checkbutton(frame1,
                              text="Bold",
                              variable=self.v1,
                              command=self.processCheckbutton)
        self.v2 = IntVar()
        rbRed = Radiobutton(frame1,
                            text="Red",
                            bg="red",
                            variable=self.v2,
                            value=1,
                            command=self.processRadiobutton)
        rbYellow = Radiobutton(frame1,
                               text="Yellow",
                               bg="yellow",
                               variable=self.v2,
                               value=2,
                               command=self.processRadiobutton)

        # set the buttons in the frame
        cbtBold.grid(row=1, column=1)
        rbRed.grid(row=1, column=2)
        rbYellow.grid(row=1, column=3)

        # create the second frame
        frame2 = Frame(window)
        frame2.pack()

        # create labels and entry and button and message
        label = Label(frame2, text="Enter Your Name: ")
        self.name = StringVar()
        entryName = Entry(frame2, textvariable=self.name)
        btGetName = Button(frame2, text="Get Name", command=self.processButton)
        message = Message(frame2, text="This is the Message Widget")

        # position what we just made
        label.grid(row=1, column=1)
        entryName.grid(row=1, column=2)
        btGetName.grid(row=1, column=3)
        message.grid(row=1, column=4)

        # create a text window and add text to it
        text = Text(window)
        text.pack()
        text.insert(END, "Tip\nThe Best way to learn tkinter is to read ")
        text.insert(END, "these carefully designed examples and use them ")
        text.insert(END, "to create your application")

        window.mainloop()
Ejemplo n.º 27
0
    def displayHighScores(self):

        top = tk.Toplevel()
        top.title("High Scores")
        try:
            f = open("HS" + self.level, "r")
        except IOError:
            f= open("HS" + self.level,"w+")

        scores = []

        f = open("HS" + self.level, "r")
        line = f.readline()
        counter = 1
        message = "" # variable containing the string to show in the message
        while line and counter < 11:
            if 'SEP' in line: #we re separating the player name and his score with the SEP
                message += str(counter) + " - " + line.split("SEP")[0].strip() + " : " + line.split("SEP")[1].strip() + "\n"
                counter = counter + 1
            line = f.readline()


        msg = Message(top, text=message, width=200)
        msg.config(font=("Courier", 12))
        msg.pack()

        button = tk.Button(top, text="Ok", command=top.destroy)
        button.pack()
        pass
Ejemplo n.º 28
0
    def __init__(self,
                 master,
                 variable,
                 anchor=W,
                 bordercolor=None,
                 borderwidth=1,
                 padx=0,
                 pady=0,
                 background=None,
                 foreground=None,
                 font=None):
        Cell.__init__(self,
                      master,
                      background=background,
                      highlightbackground=bordercolor,
                      highlightcolor=bordercolor,
                      highlightthickness=borderwidth,
                      bd=0)

        self._message_widget = Message(self,
                                       textvariable=variable,
                                       font=font,
                                       background=background,
                                       foreground=foreground)
        self._message_widget.pack(expand=True,
                                  padx=padx,
                                  pady=pady,
                                  anchor=anchor)

        self.bind("<Configure>", self._on_configure)
Ejemplo n.º 29
0
 def pop_up(self, text):
     top = Toplevel()
     top.title("ERROR")
     msg = Message(top, text=text)
     msg.pack()
     button = Button(top, text="Dismiss", command=top.destroy)
     button.pack()
Ejemplo n.º 30
0
    def __init__(self, master):
        ''' Initializes the GUI. '''
        self.master = master
        self.bg = "#90EE90"
        self.fg = "#654321"
        self.e_page = "empty"
        master.title("Trail Blazer")
        master.geometry("1920x1080")
        master.configure(bg=self.bg)
        master.bind("<Escape>", self.close)

        self.start = Frame(master, height=1080, width=1920, bg=self.bg)
        self.start.pack()
        self.start.focus_set()
        self.start.bind("<Return>", self.login_page)
        self.greet = Label(self.start, text="Welcome to our Route Suggestion GUI!", font=("sans serif", 50),
                           fg=self.fg, bg=self.bg, pady=10)
        self.greet.pack()
        self.intro = Message(self.start, text="We are writing software to help generate and visualize new routes for runners, walkers, and bikers. \nWe are creating this for our Software Design final project.",
                             font=("sans serif", 20), width=1900, justify=CENTER, fg=self.fg, bg=self.bg, pady=10)
        self.intro.pack()


        self.buttons1 = Frame(self.start, width=500, bg=self.bg)
        self.buttons1.pack()
        self.proceed = Button(self.buttons1, text="Proceed", bg="#64e764", fg="#654321", pady=5,
                              activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.login_page)
        self.proceed.grid(row=0, column=0)
        self.cancel = Button(self.buttons1, text="Cancel", bg="#64e764", fg="#654321", pady=5,
                             activebackground="#bcf5bc", activeforeground="#8b5d2e", command=master.quit)
        self.cancel.grid(row=0, column=1)

        self.logo = PhotoImage(file="images/trail_blazer_logo.gif")
        self.logo_disp = Label(self.start, image=self.logo, fg=self.fg, bg=self.bg)
        self.logo_disp.pack(side=BOTTOM)