コード例 #1
0
    def units(self):
        mainframe = Frame(self.root)
        mainframe.master.title("Units")
        mainframe.style = Style()
        mainframe.style.theme_use("default")

        message = 'How would you like to measure the EC?'

        lbl1 = Message(mainframe, text=message)
        lbl1.pack(expand=True, fill='x')
        lbl1.bind("<Configure>", lambda e: lbl1.configure(width=e.width - 10))

        mainframe.pack(fill=BOTH, expand=True)

        button1 = Button(mainframe,
                         text="Date",
                         command=lambda: self.save_value("Date"))
        button1.pack(side=LEFT, padx=5, pady=5)
        button2 = Button(mainframe,
                         text="Flight Hours",
                         command=lambda: self.save_value("FH"))
        button2.pack(side=RIGHT, padx=5, pady=5)
        button3 = Button(mainframe,
                         text="Flight Cycles",
                         command=lambda: self.save_value("FC"))
        button3.pack(side=RIGHT, padx=5, pady=5)

        self.root.mainloop()
コード例 #2
0
ファイル: python.py プロジェクト: byeonghooh/Programming_Code
class Data_Cell(Cell):
    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)

    def _on_configure(self, event):
        self._message_widget.configure(width=event.width)
コード例 #3
0
ファイル: model_tkinter_stop.py プロジェクト: gisworld/ABM
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)
コード例 #4
0
ファイル: day15.py プロジェクト: lukasHD/adventofcode2019
    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()
コード例 #5
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
コード例 #6
0
ファイル: train.py プロジェクト: hugohouel/piano-jazz-trainer
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()
コード例 #7
0
ファイル: Utils.py プロジェクト: rjhiles/RaspberryPiTimeClock
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)
コード例 #8
0
 def destroy():
     editbook.destroy()
     updatebook.destroy()
     master = Tk()
     w = Message(master, text="Records Have Been Updated!!!")
     w.pack()
     mainloop()
コード例 #9
0
ファイル: ui.py プロジェクト: HarryTheBadger/TWBatMan
    def initUI(self, server):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True, padx = 300)
        # self.centerWindow()

        menubar = Menu(self.parent)
        self.parent.config(menu = menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label = "Exit", command = self.onExit)
        menubar.add_cascade(label = "File", menu = fileMenu)

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        # svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        svcs = server.getservices()
        hostname = server.gethostname().strip()
        servertype = server.gettype().strip()

        frame0 = Labelframe(self, text = "Server Details",  borderwidth = 1)
        frame0.grid(column = 0, row = 0, sticky = W)
        
        so = StringVar()
        svroverview = Message(frame0, textvariable = so, anchor = W, width = 300)
        svroverview.grid(column = 0, row = 0)
        sstr = "Server: {}\n".format(hostname)
        sstr += "Server Type: {}".format(servertype)
        so.set(sstr)
        
        
        frame1 = Labelframe(self, text = "Service Status", borderwidth = 1)
        frame1.grid(column = 0, row = 1, sticky = W)


        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = ""

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.grid(column = 0, row = 2, sticky = W)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.grid(column = 0, row = 0)
        okButton = Button(frame4, text = "OK")
        okButton.grid(column = 1, row = 0)
コード例 #10
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()
コード例 #11
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()
コード例 #12
0
ファイル: UI.py プロジェクト: pbourachot/cours
    def version(self):

        top = Toplevel(root)
        top.title("Au sujet de ce QCM")
        msg = Message(top, text="Version xx")
        msg.pack()
        button = Button(top, text="Fermer", command=top.destroy)
        button.pack()
コード例 #13
0
ファイル: CodeEditor.py プロジェクト: daniiel-morales/tenor-C
    def show_info(self):
        window = Toplevel()
        window['bg'] = 'black'

        grammar = Message(window)
        grammar['fg'] = 'white'
        grammar['bg'] = 'black'
        grammar['text'] = 'Augus intermediate code by Engr. Espino\nTenorC 1.23.2a Developed by @danii_mor\n 201314810'
        grammar.pack(side='left')
コード例 #14
0
    def messBox(self, title, message):
        top = Toplevel()
        top.title(title)

        msg = Message(top, text=message)
        msg.pack()

        button = Button(top, text="OK", command=top.destroy)
        button.pack()
コード例 #15
0
    def cmd_analyze(self):
        # analyze
        _top = Toplevel()
        _top.title = '统计结果'
        msg = Message(_top, text=self.get_analyze_result())
        msg.pack()

        button = Button(_top, text="确认", command=_top.destroy)
        button.pack()
コード例 #16
0
 def lang():
     l = (delete.get(), )
     insert = "DELETE FROM BOOK WHERE ID = %s"
     cur.execute(insert, l)
     mydb.commit()
     removebook.destroy()
     master = Tk()
     win = Message(master, text="Records Have been deleted successfully")
     win.pack()
     mainloop()
コード例 #17
0
ファイル: CodeEditor.py プロジェクト: daniiel-morales/titus
    def show_info(self):
        window = Toplevel()
        window['bg'] = 'black'

        grammar = Message(window)
        grammar['fg'] = 'white'
        grammar['bg'] = 'black'
        grammar[
            'text'] = 'Augus code by Engr. Espino\nTitus 1.46.13a Developed by @danii_mor\n 201314810'
        grammar.pack(side='left')
コード例 #18
0
ファイル: Python-GUI.py プロジェクト: nofaralfasi/Python-GUI
 def instruction(self):
     window = Tk()
     window.title("Instructions")
     for i in self.instructions:
         Label(window,
               text="Question #" + str(self.instructions.index(i) + 1),
               font="times 16 bold").pack()
         msg = Message(window, text=i, width=700)
         msg.config(font=('times', 14))
         msg.pack()
     window.mainloop()
コード例 #19
0
 def warn(self, text):
     self.boo = False
     window = Tk()
     window.geometry('400x150')
     window.title('警告!')
     message = Message(window, text=errorDic[text], width=400)
     message.pack()
     button = Button(window, text='关闭', command=window.destroy)
     button.pack()
     window.mainloop()
     del window, message, button
コード例 #20
0
 def help(self):
     hText = "Using WASD or the arrow keys, you must navigate your character across the randomly generated " \
             "map to the arrow randomly placed on the map. If you emerge victorious in your battles " \
             "across the land, you will receive a small stat boost and some loot that will degrade " \
             "after each turn. Apart from items that increase difficulty, your movement will determine the " \
             "increase as well based on the color of the pixel you have moved to. During your journey," \
             " you will also encounter merchants that sell items that can be purchased multiple times " \
             "if you have the gold. NOTE: Restarting makes the windows unresponsive until it has fully loaded."
     h = Toplevel(self.window)
     h.wm_title("Help")
     msg = Message(h, text=hText)
     msg.pack()
コード例 #21
0
 def accessg():
     rest.destroy()
     insert = "DROP DATABASE tetrahedron"
     cur.execute(insert)
     mydb.commit()
     master = Tk()
     master.geometry("150x150")
     w = Message(
         master,
         text="Database Deleted Successfully........Restart Program!!!")
     w.pack()
     mainloop()
コード例 #22
0
 def open_running(self, task):
     ''' Displays a message while running the simulation '''
     popup = Toplevel(self)
     x = self.winfo_x()
     y = self.winfo_y()
     popup.geometry("+%d+%d" % (x//2, y//2))
     popup.title("Running")
     msg = Message(popup, text="Running simulation. Please Wait.")
     msg.pack()
     while task.is_alive():
         popup.update()
     popup.destroy() # only when thread dies.
コード例 #23
0
    def about(cls):
        """
        Launch about window.
        """
        top = Toplevel()
        top.resizable(0, 0)
        top.title('About the application')

        about_message = AboutWindow.__doc__
        msg = Message(top, text=about_message)
        msg.pack()

        btn_dismiss = Button(top, text='Dismiss', command=top.destroy)
        btn_dismiss.pack()
コード例 #24
0
ファイル: UI.py プロジェクト: pbourachot/cours
    def propriete(self):

        top = Toplevel(root)
        top.title("Propriete")

        msg = Message(top, text="Nombre de questions")
        msg.pack()

        question = Entry(top, textvariable=self.nbQuestion)

        question.pack()

        button = Button(top, text="Fermer", command=top.destroy)
        button.pack()
コード例 #25
0
ファイル: CodeEditor.py プロジェクト: daniiel-morales/tenor-C
 def show_grammar(self):
     if self.__sym_table:
         window = Toplevel()
         window['bg'] = 'black'
         productions = self.__sym_table.getGrammar()
         keys = list(productions.keys())
         keys.sort()
         grammar = Message(window)
         txt = ''
         for production in keys:
             txt += productions[production] + '\n' 
         grammar['fg'] = 'white'
         grammar['bg'] = 'black'
         grammar['text'] = txt
         grammar.pack(side='left')
コード例 #26
0
def Instructions():

    # GUI construct for How to play
    ''' A simple guide to the game'''

    Instruct = Tk()
    Instruct.title("How to Play")

    message = 'Captain!!!, First Officer Jones Reporting.\nEnemy Ships have started attacking us.\nOur Radars are jammed and so are theirs.\nWe do have limited missiles and we need to face our enemy soon or our Motherland will be in grave danger.\nIntelligence report has informed there are three Enemy Battleships.\nCaptain, it is up to you to save us.\nGod Help us.\n\nYou need to predict enemy ships locations and annihilate them before they destroy you.To destroy a ship, you need to hit it in three locations.\nAll the best, Captain.'
    Messagedisp = Message(Instruct,
                          text=message,
                          font=('arial', 20),
                          fg='black',
                          bg='white')
    Messagedisp.pack()
コード例 #27
0
def show_value(ent, dataDrivenFileLoc):
    inputLocation = str(ent['inputFolder'].get())
    outputLocation= str(ent['outputFolder'].get())
    outputFileName= str(ent['fileName'].get())

    mergePDF(dataDrivenFileLoc, inputLocation, outputLocation, outputFileName)
    #print("Output Merged File generated as :" + str(outputLocation + "/" + outputFileName + ".pdf"))

    m= Message(master=CustomMessage(),
               width=500,
               pady=30,
               anchor='center',
               font='bold',
               text="Merged File placed at: " + str(outputLocation + "/" + outputFileName + ".pdf"))
    m.pack()
コード例 #28
0
ファイル: __init__.py プロジェクト: tuantvk/pystrap
def Message(root, style = "", **options):

  props = {
    'bg': load_color(style)['bgColor'],
    'fg': load_color(style)['color'],
  }

  props.update(**options)

  M = TKMessage( 
    root
  )

  print(props)

  M.config(props)
  M.pack(pady=10)
コード例 #29
0
    def open_help_window(self):
        """!
        Opens a new window at the top level of the GUI
        to display help information.
        """

        self.help_window = tk.Toplevel(self.root)
        message_str = ""
        message_str += "HOW TO:\n\n1. Open zoom address book\n"
        message_str += "2. Right click on zoom yoga group and select print. This will cause a new tab to open with all the contacts listed\n"
        message_str += "3. Close the print dialog but not the print page. Right click anywhere on the page, choose 'save as' and their should be an option for 'HTML complete webpage'\n"
        message_str += "4. Make sure the folder it is saving to is correct, if not, change to that folder\n"
        message_str += "5. Change the name to whatever you want (e.g, zoom yoga 2020 05 06) and save\n"
        message_str += "6. In this application, hit the 'choose HTML' button and select the HTML that was just saved and hit 'Open'\n"
        message_str += "7. The program will take the contacts from the HTML and create an excel workbook for you. Wait and observe any messages that pop-up.\n"
        message_str += "8. When the program finishes, close the information pop-up with 'ok' button\n"
        message_str += "9. Verify that the contacts within the workbook are correct, and add any that were flagged as incomplete. If you did not see any message pop-up during the run about improperly exported contacts, you can skip this.\n"
        w = Message(self.help_window, text=message_str)
        w.pack()
コード例 #30
0
    def info_frame_update(self, selected_symbol):
        """ update info frame to display info about selected element/compound """

        self.info_empty_label.pack_forget()

        # get relevant info from table
        info_results = [
            x for x in self.info_table if x['Symbol'] == selected_symbol
        ]
        res = info_results[0]

        # clear info from previous selection
        [l.pack_forget() for l in self.info_labels]
        [e.pack_forget() for e in self.info_entries]

        self.info_labels.clear()
        self.info_entries.clear()
        self.info_im = None

        # make labels and entries for new info
        for key, value in res.items():
            if key == 'Image':
                if value != "":
                    self.info_im = PhotoImage(
                        file=os.path.join(self.IMAGE_DIR, value))
                    label = ttk.Label(self.info_frame, image=self.info_im)
                    self.info_labels.append(label)
                    label.pack()
            else:
                if value != '':
                    label = ttk.Label(self.info_frame, text=key)
                    self.info_labels.append(label)
                    label.pack()

                    info = Message(self.info_frame,
                                   text=value,
                                   aspect=500,
                                   background="white",
                                   relief="raised",
                                   fg="#535d6d")
                    self.info_entries.append(info)
                    info.pack(ipadx=5, ipady=5, pady=10)
コード例 #31
0
ファイル: CodeEditor.py プロジェクト: daniiel-morales/tenor-C
    def show_error(self):
        if self.__sym_table:
            if self.__sym_table.error != '':
                window = Toplevel()
                window['bg'] = 'black'

                grammar = Message(window)
                grammar['fg'] = 'white'
                grammar['bg'] = 'black'
                grammar['text'] = self.__sym_table.error
                grammar.pack(side='left')
            else:
                window = Toplevel()
                window['bg'] = 'black'

                grammar = Message(window)
                grammar['fg'] = 'white'
                grammar['bg'] = 'black'
                grammar['text'] = 'Not Errors Found'
                grammar.pack(side='left')
コード例 #32
0
ファイル: medium.py プロジェクト: paulogp/Python
"""
Tkinter example: Window size, title, label and message.
"""

from tkinter import Tk, Label, Message

__author__ = "paulogp"
__copyright__ = "Copyright (C) 2015 Paulo G.P."
__date__ = "16/12/2015"

if __name__ == "__main__":
    root = Tk()
    # title
    root.title("Tkinter Title")
    # size
    root.geometry("300x150+50+50")
    # label
    label1 = Label(root, text="One Label")
    label1.pack(padx=0, ipady=20)
    # text
    msg = Message(root, text="Hello, world!")
    msg.config(font=("times", 12, "italic bold underline"))
    msg.pack()
    # do
    root.mainloop()
コード例 #33
0
ファイル: TKTest1.py プロジェクト: HarryTheBadger/TWBatMan
    def initUI(self):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True)
        # self.centerWindow()

        menubar = Menu(self.parent)
        self.parent.config(menu = menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label = "Exit", command = self.onExit)
        menubar.add_cascade(label = "File", menu = fileMenu)

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        #lb = Listbox(self)
        #for i in svcs:
        #    lb.insert(END, i)

        #lb.bind("<<ListboxSelect>>", self.onSelect)
        #lb.pack(pady = 15)

        #self.var = StringVar()
        #self.label = Label(self, text = 0, textvariable = self.var)
        #self.label.pack()
        
        frame1 = Frame(self, borderwidth = 1)
        frame1.pack(fill = X, anchor = W)

        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = "Service Status\n\n"

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        #entry1 = Entry(frame1)
        #entry1.pack(fill=X, padx = 5, expand = True)

        #frame2 = Frame(self)
        #frame2.pack(fill = X)

        #label2 = Label(frame2, text = "Author", width = 6)
        #label2.pack(side=LEFT, padx = 5, pady = 5)

        #entry2 = Entry(frame2)
        #entry2.pack(fill=X, padx = 5, expand = True)

        #frame3 = Frame(self)
        #frame3.pack(fill = X)

        #label3 = Label(frame3, text = "Review", width = 6)
        #label3.pack(side=LEFT, anchor = N, padx = 5, pady = 5)

        #txt = Text(frame3)
        #txt.pack(fill=X, padx = 5, expand = True)

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.pack(fill = X)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.pack(side = RIGHT, padx = 5, pady = 5)
        okButton = Button(frame4, text = "OK")
        okButton.pack(side = RIGHT)