Python tkinter.Label() Examples

The following are 30 code examples of tkinter.Label(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: annotation_gui.py    From SEM with MIT License 9 votes vote down vote up
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
Example #2
Source File: window.py    From LPHK with GNU General Public License v3.0 8 votes vote down vote up
def popup(self, window, title, image, text, button_text, end_command=None):
        popup = tk.Toplevel(window)
        popup.resizable(False, False)
        if MAIN_ICON != None:
            if os.path.splitext(MAIN_ICON)[1].lower() == ".gif":
                dummy = None
                #popup.call('wm', 'iconphoto', popup._w, tk.PhotoImage(file=MAIN_ICON))
            else:
                popup.iconbitmap(MAIN_ICON)
        popup.wm_title(title)
        popup.tkraise(window)

        def run_end():
            popup.destroy()
            if end_command != None:
                end_command()

        picture_label = tk.Label(popup, image=image)
        picture_label.photo = image
        picture_label.grid(column=0, row=0, rowspan=2, padx=10, pady=10)
        tk.Label(popup, text=text, justify=tk.CENTER).grid(column=1, row=0, padx=10, pady=10)
        tk.Button(popup, text=button_text, command=run_end).grid(column=1, row=1, padx=10, pady=10)
        popup.wait_visibility()
        popup.grab_set()
        popup.wait_window() 
Example #3
Source File: components.py    From SEM with MIT License 8 votes vote down vote up
def __init__(self, root, resource_dir):
        ttk.Frame.__init__(self, root)
        
        self.master_selector = None
        self.resource_dir = resource_dir
        self.items = os.listdir(os.path.join(self.resource_dir, "master"))
        
        self.cur_lang = tkinter.StringVar()
        self.select_lang_label = ttk.Label(root, text=u"select language:")
        self.langs = ttk.Combobox(root, textvariable=self.cur_lang)
        
        self.langs["values"] = self.items

        self.langs.current(0)
        for i, item in enumerate(self.items):
            if item == "fr":
                self.langs.current(i)
        
        self.langs.bind("<<ComboboxSelected>>", self.select_lang) 
Example #4
Source File: overlay_label.py    From ultra_secret_scripts with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, text="IPSUM DOLOREM", pos="BR"):
        self.text = text
        self.pos = pos
        self.fg = "black"
        self.bg = "#f1f2f2"  # default transparent color
        self.width = 0
        self.height = 0

        tk = tkinter.Tk()
        self.label = tkinter.Label(tk, anchor="w")
        self.label.config(font=("Consolas", 8))
        self.label.master.overrideredirect(True)
        self.label.master.lift()
        self.label.master.wm_attributes("-topmost", True)
        self.label.master.wm_attributes("-disabled", True)
        self.label.master.wm_attributes("-transparentcolor", "#f1f2f3")

        hWindow = pywintypes.HANDLE(int(self.label.master.frame(), 16))
        exStyle = win32con.WS_EX_COMPOSITED | win32con.WS_EX_LAYERED | win32con.WS_EX_NOACTIVATE | \
                  win32con.WS_EX_TOPMOST | win32con.WS_EX_TRANSPARENT
        win32api.SetWindowLong(hWindow, win32con.GWL_EXSTYLE, exStyle)

        self.label.pack()
        self.update() 
Example #5
Source File: viewer.py    From networkx_viewer with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, main_window, msg='Please enter a node:'):
        tk.Toplevel.__init__(self)
        self.main_window = main_window
        self.title('Node Entry')
        self.geometry('170x160')
        self.rowconfigure(3, weight=1)

        tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
                                      sticky='NESW',padx=5,pady=5)
        self.posibilities = [d['dataG_id'] for n,d in
                    main_window.canvas.dispG.nodes_iter(data=True)]
        self.entry = AutocompleteEntry(self.posibilities, self)
        self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
        self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)

        tk.Button(self, text='Ok', command=self.destroy).grid(
            row=3, column=0, sticky='ESW',padx=5,pady=5)
        tk.Button(self, text='Cancel', command=self.cancel).grid(
            row=3, column=1, sticky='ESW',padx=5,pady=5)

        # Make modal
        self.winfo_toplevel().wait_window(self) 
Example #6
Source File: fleetConnectionWindow.py    From PyEveLiveDPS with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, loginQueue):
        tk.Toplevel.__init__(self)
        
        self.configure(pady=10, padx=20)
        
        self.wm_attributes("-topmost", True)
        self.wm_title("PyEveLiveDPS Awaiting Login")
        try:
            self.iconbitmap(sys._MEIPASS + '\\app.ico')
        except Exception:
            try:
                self.iconbitmap("app.ico")
            except Exception:
                pass
        self.geometry("200x50")
        self.update_idletasks()
            
        tk.Label(self, text='Waiting for you to login...').grid(row=1, column=1)

        self.loginStatus = loginQueue.get()

        self.destroy() 
Example #7
Source File: labelSettingsFrame.py    From PyEveLiveDPS with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        gridFrame = self._nametowidget(parent.winfo_parent())
        self.parent = self._nametowidget(gridFrame.winfo_parent())
        
        self.grid(row="0", column="0", sticky="ew")
        self.columnconfigure(0,weight=1)
        self.singleLabel = singleLabel = tk.Label(self, text=title)
        singleLabel.grid(row="0",column="0", sticky="ew")
        self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0)
        listbox.delete(0,tk.END)
        listbox.insert(0,decimalPlaces)
        listbox.grid(row="0", column="1")
        checkboxValue = tk.IntVar()
        checkboxValue.set(inThousands)
        self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0)
        checkbox.var = checkboxValue
        checkbox.grid(row="0", column="2")
        singleLabel.bind("<Button-1>", lambda e:self.dragStart(e, listbox, checkbox)) 
Example #8
Source File: window.py    From LPHK with GNU General Public License v3.0 6 votes vote down vote up
def popup_choice(self, window, title, image, text, choices):
        popup = tk.Toplevel(window)
        popup.resizable(False, False)
        if MAIN_ICON != None:
            if os.path.splitext(MAIN_ICON)[1].lower() == ".gif":
                dummy = None
                #popup.call('wm', 'iconphoto', popup._w, tk.PhotoImage(file=MAIN_ICON))
            else:
                popup.iconbitmap(MAIN_ICON)
        popup.wm_title(title)
        popup.tkraise(window)
        
        def run_end(func):
            popup.destroy()
            if func != None:
                func()

        picture_label = tk.Label(popup, image=image)
        picture_label.photo = image
        picture_label.grid(column=0, row=0, rowspan=2, padx=10, pady=10)
        tk.Label(popup, text=text, justify=tk.CENTER).grid(column=1, row=0, columnspan=len(choices), padx=10, pady=10)
        for idx, choice in enumerate(choices):
            run_end_func = partial(run_end, choice[1])
            tk.Button(popup, text=choice[0], command=run_end_func).grid(column=1 + idx, row=1, padx=10, pady=10)
        popup.wait_visibility()
        popup.grab_set()
        popup.wait_window() 
Example #9
Source File: client-test2.py    From The-chat-room with MIT License 6 votes vote down vote up
def video_invite_window(message, inviter_name):
    invite_window = tkinter.Toplevel()
    invite_window.geometry('300x100')
    invite_window.title('Invitation')
    label1 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text=inviter_name)
    label1.pack()
    label2 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text='invites you to video chat!')
    label2.pack()

    def accept_invite():
        invite_window.destroy()
        video_accept(message[message.index('INVITE') + 6:])

    def refuse_invite():
        invite_window.destroy()

    Refuse = tkinter.Button(invite_window, text="Refuse", command=refuse_invite)
    Refuse.place(x=60, y=60, width=60, height=25)
    Accept = tkinter.Button(invite_window, text="Accept", command=accept_invite)
    Accept.place(x=180, y=60, width=60, height=25) 
Example #10
Source File: client.py    From The-chat-room with MIT License 6 votes vote down vote up
def video_invite_window(message, inviter_name):
    invite_window = tkinter.Toplevel()
    invite_window.geometry('300x100')
    invite_window.title('Invitation')
    label1 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text=inviter_name)
    label1.pack()
    label2 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text='invites you to video chat!')
    label2.pack()

    def accept_invite():
        invite_window.destroy()
        video_accept(message[message.index('INVITE') + 6:])

    def refuse_invite():
        invite_window.destroy()

    Refuse = tkinter.Button(invite_window, text="Refuse", command=refuse_invite)
    Refuse.place(x=60, y=60, width=60, height=25)
    Accept = tkinter.Button(invite_window, text="Accept", command=accept_invite)
    Accept.place(x=180, y=60, width=60, height=25) 
Example #11
Source File: client-test.py    From The-chat-room with MIT License 6 votes vote down vote up
def video_invite_window(message, inviter_name):
    invite_window = tkinter.Toplevel()
    invite_window.geometry('300x100')
    invite_window.title('Invitation')
    label1 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text=inviter_name)
    label1.pack()
    label2 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text='invites you to video chat!')
    label2.pack()

    def accept_invite():
        invite_window.destroy()
        video_accept(message[message.index('INVITE') + 6:])

    def refuse_invite():
        invite_window.destroy()

    Refuse = tkinter.Button(invite_window, text="Refuse", command=refuse_invite)
    Refuse.place(x=60, y=60, width=60, height=25)
    Accept = tkinter.Button(invite_window, text="Accept", command=accept_invite)
    Accept.place(x=180, y=60, width=60, height=25) 
Example #12
Source File: toolkit.py    From PickTrue with MIT License 6 votes vote down vote up
def __init__(self, master=None, store_name=None, **kwargs):
        super(FileBrowse, self).__init__(master=master, **kwargs)
        self.label_text = tk.StringVar()
        btn = tk.Button(self, text="下载到", command=self.choose_file)
        btn.pack(
            side=tk.LEFT,
        )

        tk.Label(self, textvariable=self.label_text).pack(
            side=tk.LEFT,
            fill=tk.X,
        )
        self.pack(fill=tk.X)

        self._store_name = store_name
        if store_name is not None:
            self._config = config_store
            save_path = self._config.op_read_path(store_name) or get_working_dir()
        else:
            self._config = None
            save_path = get_working_dir()

        self.label_text.set(
            save_path
        ) 
Example #13
Source File: ch1-6.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self.title("Hello Tkinter")
        self.label_text = tk.StringVar()
        self.label_text.set("My Name Is: ")

        self.name_text = tk.StringVar()

        self.label = tk.Label(self, textvar=self.label_text)
        self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=10)

        self.name_entry = tk.Entry(self, textvar=self.name_text)
        self.name_entry.pack(fill=tk.BOTH, expand=1, padx=20, pady=20)

        hello_button = tk.Button(self, text="Say Hello", command=self.say_hello)
        hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20))

        goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye)
        goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20)) 
Example #14
Source File: nemo_app.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, image, initialField, initialText):
        frm = tk.Frame(root)
        frm.config(background="white")
        self.image = tk.PhotoImage(format='gif',data=images[image.upper()])
        self.imageDimmed = tk.PhotoImage(format='gif',data=images[image])
        self.img = tk.Label(frm)
        self.img.config(borderwidth=0)
        self.img.pack(side = "left")
        self.fld = tk.Text(frm, **fieldParams)
        self.initScrollText(frm,self.fld,initialField)
        frm = tk.Frame(root)
        self.txt = tk.Text(frm, **textParams)
        self.initScrollText(frm,self.txt,initialText)
        for i in range(2):
            self.txt.tag_config(colors[i], background = colors[i])
            self.txt.tag_config("emph"+colors[i], foreground = emphColors[i]) 
Example #15
Source File: Emotion Recognition.py    From Emotion-Recognition-Using-SVMs with MIT License 6 votes vote down vote up
def updateImageCount(happyCount, sadCount):
    global HCount, SCount, imageCountString, countString   # Updating only when called by smileCallback/noSmileCallback
    if happyCount is True and HCount < 400:
        HCount += 1
    if sadCount is True and SCount < 400:
        SCount += 1
    if HCount == 400 or SCount == 400:
        HCount = 0
        SCount = 0
    # --- Updating Labels
    # -- Main Count
    imageCountPercentage = str(float((trainer.index + 1) * 0.25)) \
        if trainer.index+1 < len(faces.images) else "Classification DONE! 100"
    imageCountString = "Image Index: " + str(trainer.index+1) + "/400   " + "[" + imageCountPercentage + " %]"
    labelVar.set(imageCountString)           # Updating the Label (ImageCount)
    # -- Individual Counts
    countString = "(Happy: " + str(HCount) + "   " + "Sad: " + str(SCount) + ")\n"
    countVar.set(countString) 
Example #16
Source File: __init__.py    From 3DGCN with MIT License 6 votes vote down vote up
def ShowMol(mol, size=(300, 300), kekulize=True, wedgeBonds=True, title='RDKit Molecule', **kwargs):
    """ Generates a picture of a molecule and displays it in a Tkinter window
    """
    global tkRoot, tkLabel, tkPI
    try:
        import Tkinter
    except ImportError:
        import tkinter as Tkinter
    try:
        import ImageTk
    except ImportError:
        from PIL import ImageTk

    img = MolToImage(mol, size, kekulize, wedgeBonds, **kwargs)

    if not tkRoot:
        tkRoot = Tkinter.Tk()
        tkRoot.title(title)
        tkPI = ImageTk.PhotoImage(img)
        tkLabel = Tkinter.Label(tkRoot, image=tkPI)
        tkLabel.place(x=0, y=0, width=img.size[0], height=img.size[1])
    else:
        tkPI.paste(img)
    tkRoot.geometry('%dx%d' % (img.size)) 
Example #17
Source File: base.py    From mentalist with MIT License 6 votes vote down vote up
def add_attr(self, attr_name, right_label_text=None, *args):
        '''Add attr to the lower frame with a '-' button & title
        
        attr_name: title to be shown on the left side
        right_label_text: label string to be shown on the right side, which is
                          a word count or 'Calculating...'
        '''
        if len(self.attrs) == 0:
            self.lower_frame = Frame(self)
            self.lower_frame.pack(side="bottom", fill="both")
        attr = LabeledFrame(self.lower_frame, title=attr_name)
        btn_add_file = Tk.Button(attr, text=' - ')
        btn_add_file.pack(fill="both", side="left", padx=10, pady=5)
        btn_add_file.bind("<ButtonRelease-1>", partial(self.on_remove_attr, attr))
        lb_base_files = Tk.Label(attr, text=attr_name)
        lb_base_files.pack(fill="both", side="left", padx=10, pady=10)
        
        if right_label_text is not None:
            attr.right_label = Tk.Label(attr, text=right_label_text, font=('Helvetica', '10', 'italic'))
            attr.right_label.pack(fill="both", side="right", padx=10, pady=10)
        else:
            attr.right_label = None
        
        attr.pack(side="top", fill="both")
        self.attrs.append(attr) 
Example #18
Source File: components.py    From SEM with MIT License 6 votes vote down vote up
def __init__(self, root, main_window, button_opt):
        ttk.Frame.__init__(self, root)
        
        self.root = root
        self.main_window = main_window
        self.current_files = None
        self.button_opt = button_opt
        
        # define options for opening or saving a file
        self.file_opt = options = {}
        options['defaultextension'] = '.txt'
        options['filetypes'] = [('all files', '.*'), ('text files', '.txt')]
        options['initialdir'] = os.path.expanduser("~")
        options['parent'] = root
        options['title'] = 'Select files to annotate.'
        
        self.file_selector_button = ttk.Button(self.root, text=u"select file(s)", command=self.filenames)
        self.label = ttk.Label(self.root, text=u"selected file(s):")
        self.fa_search = tkinter.PhotoImage(file=os.path.join(self.main_window.resource_dir, "images", "fa_search_24_24.gif"))
        self.file_selector_button.config(image=self.fa_search, compound=tkinter.LEFT)
        
        self.scrollbar = ttk.Scrollbar(self.root)
        self.selected_files = tkinter.Listbox(self.root, yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.selected_files.yview) 
Example #19
Source File: ChessView.py    From cchess-zero with MIT License 6 votes vote down vote up
def draw_board(self, board):
        self.piece_images.clear()
        self.move_images = []
        pieces = board.pieces
        for (x, y) in pieces.keys():
            self.piece_images[x, y] = tkinter.PhotoImage(file=pieces[x, y].get_image_file_name())
            self.can.create_image(board_coord(x), board_coord(y), image=self.piece_images[x, y])
        if board.selected_piece:
            for (x, y) in board.selected_piece.get_move_locs(board):
                self.move_images.append(tkinter.PhotoImage(file="images/OOS.gif"))
                self.can.create_image(board_coord(x), board_coord(y), image=self.move_images[-1])
                # self.can.create_text(board_coord(x), board_coord(y),text="Hello")

        # label = tkinter.Label(self.root, text='Hello world!')
        # label.place(x=30,y=30)
        # label.pack(fill='x', expand=1) 
Example #20
Source File: lineSettingsFrame.py    From PyEveLiveDPS with GNU General Public License v3.0 6 votes vote down vote up
def addLine(self, settingsList, dpsFrame):
        lineNumber = len(settingsList)
        settingsList.append({"transitionValue": "", "color": "#FFFFFF"})
        settingsList[lineNumber]["transitionValue"] = tk.StringVar()
        settingsList[lineNumber]["transitionValue"].set(str(100*lineNumber))
              
        removeButton = tk.Button(dpsFrame, text="X", command=lambda:self.removeLine(lineNumber, settingsList, dpsFrame))
        font = tkFont.Font(font=removeButton['font'])
        font.config(weight='bold')
        removeButton['font'] = font
        removeButton.grid(row=lineNumber, column="0")
        lineLabel = tk.Label(dpsFrame, text="Threshold when the line changes color:")
        lineLabel.grid(row=lineNumber, column="1")
        initialThreshold = tk.Entry(dpsFrame, textvariable=settingsList[lineNumber]["transitionValue"], width=10)
        initialThreshold.grid(row=lineNumber, column="2")
        initialLabel = tk.Label(dpsFrame, text="Color:")
        initialLabel.grid(row=lineNumber, column="3")
        colorButton = tk.Button(dpsFrame, text="    ", 
                                command=lambda:self.colorWindow(settingsList[lineNumber], colorButton), 
                                bg=settingsList[lineNumber]["color"])
        colorButton.grid(row=lineNumber, column="4") 
Example #21
Source File: labelSettingsFrame.py    From PyEveLiveDPS with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, mainWindow, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.mainWindow = mainWindow
        self.columnconfigure(2, weight=1)
        
        self.gridColumns = settings.getLabelColumns()
        self.labels = settings.getLabels()
        
        tk.Label(self, text="Labels on the left grid will be attached to the left side of the window.\n" +
                    "Labels on the right grid will be attached to the right side of the window.\n\n" + 
                    "You can drag and drop labels to move them to a different position in the grid."
                    ).grid(row="0", column="1", columnspan="5", pady=10)
        tk.Label(self, text="Use the arrows to move columns from one side of the window to another."
                    ).grid(row="3", column="1", columnspan="5")
        tk.Label(self, text="The number box represents how many decimal places the label will use. 0 is no decimal places.\n" +
                    "The checkbox is to represent the number in thousands.\n\n" +
                    "For instance, if you choose '3' decimals, and check the box, the number 1,234 will show as 1.234K"
                    ).grid(row="100", column="1", columnspan="5", pady=10)
        
        tk.Frame(self, height="1", width="10").grid(row="1",column="2")
        
        self.makeArrowButtons()
        
        self.makeGrids() 
Example #22
Source File: simulationWindow.py    From PyEveLiveDPS with GNU General Public License v3.0 6 votes vote down vote up
def addRow(self, prefix, row):
        self.values[prefix] = {}
        self.values[prefix]["floor"] = tk.Entry(self.innerFrame, width=7)
        self.values[prefix]["floor"].grid(row=row, column="1")
        self.values[prefix]["floor"].insert(0, "0")
        tk.Label(self.innerFrame, text="-").grid(row=row, column="2")
        self.values[prefix]["ceiling"] = tk.Entry(self.innerFrame, width=7)
        self.values[prefix]["ceiling"].grid(row=row, column="3")
        self.values[prefix]["ceiling"].insert(0, "100")
        tk.Label(self.innerFrame, text="  every").grid(row=row, column="4")
        self.values[prefix]["cycle"] = tk.Entry(self.innerFrame, width=4)
        self.values[prefix]["cycle"].grid(row=row, column="5")
        self.values[prefix]["cycle"].insert(0, "3")
        tk.Label(self.innerFrame, text="s  ").grid(row=row, column="6")
        self.geometry("%sx%s" % (self.winfo_width(), self.winfo_height()+20))
        self.update_idletasks() 
Example #23
Source File: toolkit.py    From PickTrue with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.variable=tk.StringVar()
        self.label=tk.Label(
            self, bd=1, relief=tk.SUNKEN, anchor=tk.W,
            textvariable=self.variable,
            font=('arial', 16, 'normal')
        )
        self.variable.set('')
        self.label.pack(fill=tk.X)
        self.pack(fill=tk.BOTH) 
Example #24
Source File: toolkit.py    From PickTrue with MIT License 5 votes vote down vote up
def __init__(self, master=None, name=None, **kwargs):
        super(NamedInput, self).__init__(master=master, **kwargs)
        assert name is not None
        self._name = name
        label = tk.Label(self, text=name)
        label.pack(side=tk.LEFT)

        self.entry = tk.Entry(self)
        self.entry.pack(side=tk.LEFT, fill=tk.X, expand=1)
        self.pack(fill=tk.X) 
Example #25
Source File: toolkit.py    From PickTrue with MIT License 5 votes vote down vote up
def __init__(self, master=None, name=None, **kwargs):
        super(PasswordInput, self).__init__(master=master, **kwargs)
        assert name is not None
        self._name = name
        label = tk.Label(self, text=name)
        label.pack(side=tk.LEFT)

        self.entry = tk.Entry(self, show="*")
        self.entry.pack(side=tk.LEFT, fill=tk.X, expand=1)
        self.pack(fill=tk.X) 
Example #26
Source File: wicc_view_dos.py    From WiCC with GNU General Public License v3.0 5 votes vote down vote up
def build_window(self):
        """
        Generates the window.

        :author: Pablo Sanz Alguacil
        """

        self.root = Toplevel()
        self.root.geometry('310x200')
        self.root.resizable(width=False, height=False)
        self.root.title('DoS Attack')
        self.root.protocol("WM_DELETE_WINDOW", self.destroy_window)

        self.labelframe_info = LabelFrame(self.root)
        self.labelframe_info.pack(fill="both", expand="no", pady=15)

        self.label_info = Label(self.labelframe_info, pady=15, text="With this tool yo can perform a DoS Attack."
                                                                    "\n\nIntroduce the attack's duration in seconds."
                                                                    "\nIntroduce 0 for infite time attack."
                                                                    "\nWait until the tool finishes the attack. ")
        self.label_info.pack()

        self.labelframe_buttons = LabelFrame(self.root)
        self.labelframe_buttons.pack(fill="both", expand="no", pady=5)

        self.label_time = Label(self.labelframe_buttons, text="Time: ")
        self.label_time.grid(column=0, row=0, padx=5, pady=5)

        self.entry = ttk.Entry(self.labelframe_buttons)
        self.entry.grid(column=1, row=0, padx=5, pady=5)

        self.button_start = Button(self.labelframe_buttons, text="Start", command=self.start_dos)
        self.button_start.grid(column=2, row=0, padx=5, pady=5) 
Example #27
Source File: wicc_view_about.py    From WiCC with GNU General Public License v3.0 5 votes vote down vote up
def build_window(self):
        """
        Generates the window.

        :author: Pablo Sanz Alguacil
        """

        self.root = Toplevel()
        self.root.geometry('460x300')
        self.root.resizable(width=False, height=False)
        self.root.title('About')

        # LABEL - INFO
        self.label_info = Label(self.root, pady=15,
                                text="Developed as the Group Project for 3rd year of the Bachelor "
                                     "\nof Science in Computing in Digital Forensics and Cyber Security "
                                     "\nat the Technological University Dublin."
                                     "\n")

        self.label_info.pack()

        self.button = Button(self.root, text="Project page", command=self.open_link)
        self.button.pack()

        self.frame = Frame(self.root)
        self.frame.pack()

        photo = PhotoImage(file=self.logo)
        photo_label = Label(self.frame, image=photo)
        photo_label.image = photo
        photo_label.pack(side=LEFT)

        self.label_collaborators = Label(self.frame, text="\tPablo Sanz Alguacil (Code)"
                                     "\n\tMiguel Yanes Fernández (Code)"
                                     "\n\tAdam Chalkley (Research)")
        self.label_collaborators.pack(side=RIGHT) 
Example #28
Source File: common.py    From PyOptiX with MIT License 5 votes vote down vote up
def __init__(self, img):
        parent = Tk()
        Frame.__init__(self, parent)
        self.pack(fill=BOTH, expand=1)
        label1 = Label(self)
        label1.photo = ImageTk.PhotoImage(img)
        label1.config(image=label1.photo)
        label1.pack(fill=BOTH, expand=1)
        parent.mainloop() 
Example #29
Source File: findwindow.py    From Tkinter-GUI-Programming-by-Example with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(**kwargs  )

        self.geometry('350x100')
        self.title('Find and Replace')

        self.text_to_find = tk.StringVar()
        self.text_to_replace_with = tk.StringVar()

        top_frame = tk.Frame(self)
        middle_frame = tk.Frame(self)
        bottom_frame = tk.Frame(self)

        find_entry_label = tk.Label(top_frame, text="Find: ")
        self.find_entry = ttk.Entry(top_frame, textvar=self.text_to_find)

        replace_entry_label = tk.Label(middle_frame, text="Replace: ")
        self.replace_entry = ttk.Entry(middle_frame, textvar=self.text_to_replace_with)

        self.find_button = ttk.Button(bottom_frame, text="Find", command=self.on_find)
        self.replace = ttk.Button(bottom_frame, text="Replace", command=self.on_replace)
        self.cancel_button = ttk.Button(bottom_frame, text="Cancel", command=self.destroy)

        find_entry_label.pack(side=tk.LEFT, padx=(20, 0))
        self.find_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)

        replace_entry_label.pack(side=tk.LEFT)
        self.replace_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)

        self.find_button.pack(side=tk.LEFT, padx=(85, 0))
        self.cancel_button.pack(side=tk.RIGHT, padx=(0, 30))

        top_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30)
        middle_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30)
        bottom_frame.pack(side=tk.TOP, expand=1, fill=tk.X) 
Example #30
Source File: events.py    From Tkinter-GUI-Programming-by-Example with MIT License 5 votes vote down vote up
def on_ctrl_d(event=None):
    top = tk.Toplevel(win)
    top.geometry("200x200")
    sv = tk.StringVar()
    sv.set("Hover the mouse over me")
    label = tk.Label(top, textvar=sv)
    label.bind("<Enter>", lambda e, sv=sv: sv.set("Hello mouse!"))
    label.bind("<Leave>", lambda e, sv=sv: sv.set("Goodbye mouse!"))
    label.pack(expand=1, fill=tk.BOTH)