示例#1
0
    def showtip(self, text, parenleft, parenright):
        """Show the calltip, bind events which will close it and reposition it.
        """
        # Only called in CallTips, where lines are truncated
        self.text = text
        if self.tipwindow or not self.text:
            return

        self.widget.mark_set(MARK_RIGHT, parenright)
        self.parenline, self.parencol = map(
            int,
            self.widget.index(parenleft).split("."))

        self.tipwindow = tw = Toplevel(self.widget)
        self.position_window()
        # remove border on calltip window
        tw.wm_overrideredirect(1)
        try:
            # This command is only needed and available on Tk >= 8.4.0 for OSX
            # Without it, call tips intrude on the typing process by grabbing
            # the focus.
            tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w,
                       "help", "noActivates")
        except TclError:
            pass
        self.label = Label(tw,
                           text=self.text,
                           justify=LEFT,
                           background="#ffffe0",
                           relief=SOLID,
                           borderwidth=1,
                           font=self.widget['font'])
        self.label.pack()
        tw.update_idletasks()
        tw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)

        self.checkhideid = self.widget.bind(CHECKHIDE_VIRTUAL_EVENT_NAME,
                                            self.checkhide_event)
        for seq in CHECKHIDE_SEQUENCES:
            self.widget.event_add(CHECKHIDE_VIRTUAL_EVENT_NAME, seq)
        self.widget.after(CHECKHIDE_TIME, self.checkhide_event)
        self.hideid = self.widget.bind(HIDE_VIRTUAL_EVENT_NAME,
                                       self.hide_event)
        for seq in HIDE_SEQUENCES:
            self.widget.event_add(HIDE_VIRTUAL_EVENT_NAME, seq)
    def create_widgets(self):
        top = Toplevel(self.root)
        top.bind("<Return>", self.default_command)
        top.bind("<Escape>", self.close)
        top.protocol("WM_DELETE_WINDOW", self.close)
        top.wm_title(self.title)
        top.wm_iconname(self.icon)
        top.resizable(height=False, width=False)
        self.ttop = top
        self.top = Frame(top)

        self.row = 0
        self.top.grid(sticky='news')

        self.create_entries()
        self.create_option_buttons()
        self.create_other_buttons()
        self.create_command_buttons()
示例#3
0
文件: CTA.py 项目: Panumy/CTA-DB
def edit_admin_username():
    admin = manentry.get()
    sqlq = "SELECT COUNT(1) FROM db_ADMINS WHERE username = '******'" % (admin)
    cursor.execute(sqlq)
    if cursor.fetchone()[0]:
        global uschentry, win2
        win2 = Toplevel(root)
        win2.resizable(width=FALSE, height=FALSE)
        win2.title("Username change")
        uschlabel = Label(win2, text="New username")
        uschentry = Entry(win2)
        uschbutto = Button(win2, text="Change", command=change_username)
        uschlabel.pack()
        uschentry.pack()
        uschbutto.pack()
    else:
        tkMessageBox.showerror("Error", "Invalid username.")
    cnx.commit()
示例#4
0
 def __init__(self, master, manager):
     self.master = master
     self.manager = manager
     top = self.top = Toplevel(master)
     Label(top, text="Début du pas (min:sec)").pack()
     self.pas_d = Entry(top)
     self.pas_d.pack()
     Label(top, text="Fin du pas (min:sec)").pack()
     self.pas_f = Entry(top)
     self.pas_f.pack()
     Label(top, text="Début du trot (min:sec)").pack()
     self.trot_d = Entry(top)
     self.trot_d.pack()
     Label(top, text="Fin du trot (min:sec)").pack()
     self.trot_f = Entry(top)
     self.trot_f.pack()
     b1 = Button(top, text='Séparer', command=self.split_data_file)
     b1.pack()
示例#5
0
def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top
    if not py3:
        reload(sys)  # fix filenames encodings. May be too rude, check url:
        sys.setdefaultencoding('utf8')  # https://github.com/joeyespo/grip/issues/86
    initialize_plot(w.plot_frame)
    w.canvas.camera = Camera()
    w.color_pool = cycle(['aqua', 'yellow', 'silver', 'lime', 'blue',
                        'red', 'green', 'orange', 'maroon', 'pink',
                        'purple', 'violet', 'black'])
    btAddContribClick()  # add one default contribution - background
    w.model_fn = 'extinction.txt'
    w.constr_win = Toplevel(root)
    w.constr_win_app = ConstraintsWindow(w.constr_win)
    w.constr_win.withdraw()
示例#6
0
    def about(self):
        """Open an about window.

        Window gives authors, SET version number, and icon credit.
        """
        # Instantiates a new Toplevel about window.
        about_window = Toplevel(self.root)
        about_window.geometry('350x335+25+25')
        about_window.title('About')
        about_window.wm_iconbitmap(constants.ICO)
        about_window.resizable(False, False)

        # Adds text to about window.
        about = Text(about_window, width=50, height=30, padx=10, pady=3)
        about.insert("end", constants.ABOUT)
        about.tag_add("abt", "1.0", "21.30")
        about.tag_config("abt", font='Times 10 bold', justify=CENTER)
        about.pack()
示例#7
0
    def __init__(self, tkRoot, app, masterComp, parentNode, logger):
        BaseView.__init__(self, tkRoot, app, logger)
        # master (upper level view) component on which this view was issued
        self.masterComp = masterComp

        self.parentNode = parentNode

        # open detailed window - will go into View class, create Canvas in this window
        self.window = Toplevel(self.tkRoot)

        # self.window.bind("<<close-window>>", self.__onClose) # doesn't work
        self.window.protocol("WM_DELETE_WINDOW", self.__onClose)
        self.window.title("%s" % self.masterComp.name)

        self.canvas = Canvas(self.window, bg=BaseView.CANVAS_BG_COLOR)
        self.canvas.pack(expand=YES, fill=BOTH)

        self.app.addActiveView(self.masterComp.name, self)
示例#8
0
    def __init__(self, parent):

        top = self.top = Toplevel(parent)

        Label(top, text="Pick your color").pack()

        self.v = 0

        rb1 = Radiobutton(top, text="Yellow", value=YELLOW, command=self.sari)
        rb1.pack()
        rb1.select()
        rb2 = Radiobutton(top, text="Green", value=GREEN, command=self.yesil)

        rb2.pack()
        rb2.deselect()

        b = Button(top, text="OK", command=self.ok)
        b.pack(pady=5)
示例#9
0
def _dyn_option_menu(parent):  # htest #
    from Tkinter import Toplevel

    top = Toplevel()
    top.title("Tets dynamic option menu")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    top.focus_set()

    var = StringVar(top)
    var.set("Old option set") #Set the default value
    dyn = DynOptionMenu(top,var, "old1","old2","old3","old4")
    dyn.pack()

    def update():
        dyn.SetMenu(["new1","new2","new3","new4"], value="new option set")
    button = Button(top, text="Change option set", command=update)
    button.pack()
示例#10
0
 def SearchGene(self):  #interface for "Select genes for analysis"
     SearchFrame = Toplevel()
     SearchFrame.title(
         "Data entry. Enter gene identifier, probesets or keywords.\n")
     scrollBar = Scrollbar(SearchFrame)
     self.inputFrame = Text(SearchFrame,
                            font="courier",
                            width=30,
                            wrap=WORD)
     self.inputFrame.pack(side=LEFT, fill=BOTH)
     scrollBar.pack(side=LEFT, fill=Y)
     self.inputFrame.config(yscrollcommand=scrollBar.set)
     scrollBar.config(command=self.inputFrame.yview)
     goButton = Button(SearchFrame,
                       text="Find",
                       fg="red",
                       command=self.SearchGenePipe)
     goButton.pack(side=BOTTOM)
示例#11
0
 def showtip(self, event=None):
     x = y = 0
     x, y, cx, cy = self.widget.bbox("insert")
     x += self.widget.winfo_rootx() + 25
     y += self.widget.winfo_rooty() + 20
     # creates a toplevel window
     self.tw = Toplevel(self.widget)
     # Leaves only the label and removes the app window
     self.tw.wm_overrideredirect(True)
     self.tw.wm_geometry("+%d+%d" % (x, y))
     label = Label(self.tw,
                   text=self.text,
                   justify='left',
                   background="#ffffff",
                   relief='solid',
                   borderwidth=0,
                   wraplength=self.wraplength)
     label.pack(ipadx=1)
    def test_basic_shadow(self):
        """
        Check shadowing of a PO's parameters.
        """
        t = TestPO()
        f = SomeFrame(Toplevel(),extraPO=t)
        f.pack()

        f.pack_param('bool_param') # (from the TestPO)

        # test that setting f.bool_param (where bool_param is
        # shadow of t.bool_param) actually sets t.bool_param
        self.assertEqual(t.bool_param,False) # so we know start state
        f.bool_param=True
        self.assertEqual(t.bool_param,True)

        # simulate a GUI set (typing then Return) & then and check
        # g.bool_param is set
        f._tkvars['bool_param'].set(False)
        self.assertEqual(t.bool_param,False)

        # check that up-to-date value is returned when g got changed elsewhere
        t.bool_param=True
        self.assertEqual(f.bool_param,True)

        # simulate a GUI get & check up-to-date value returned
        t.bool_param=False
        self.assertEqual(f._tkvars['bool_param'].get(),False)


        # CEB: the following doesn't work:
        #  self.assertRaises(AttributeError,f.does_not_exist)
        # An AttributeError *is* raised, but it doesn't seem to be
        # caught by testing mechanism. Below is equivalent test...
        try:
            f.does_not_exist
        except AttributeError:
            pass
        else:
            raise("Failed to raise AttributeError on looking up non-existent attribute 'does_not_exist'")

        f.did_not_exist = 9
        assert 'did_not_exist' in f.__dict__ # check that new attribute added to f's dict...
        self.assertEqual(f.did_not_exist,9)  # ...and that it was set
    def __init__(self, rows, cols, width=500, height=500, side=25, block_buffer=10, title='Grid', background='tan'):
        tk = Tk()
        tk.withdraw()
        top = Toplevel(tk)
        top.wm_title(title)
        top.protocol('WM_DELETE_WINDOW', top.destroy)

        self.width = width
        self.height = height
        self.rows = min(rows, MAX_ROWS)
        self.cols = min(cols, MAX_COLS)
        self.canvas = Canvas(top, width=self.width,
                             height=self.height, background=background)
        self.canvas.pack()
        self.side = side
        self.block_buffer = block_buffer
        self.cells = {}
        self.robot = []
        self.draw_environment()
示例#14
0
    def _go(self):
        view = self.getvar("graphframeview")

        if view == "onlyone":
            for child in self._right_pane.winfo_children():
                child.destroy()
                #if view in ("onlyone", "row"):
            container = FrameWithCloseButton(self._right_pane)
            self._right_pane.add(container, minsize=600)
        else:
            container = Toplevel()

        graph_class = MainWindow.GRAPH_TYPES[self._graph_type.variable.get()]

        facade = Facade(container, self._group_select.selected_group,
                        show_graph=self._show_graph_checkbutton.is_selected(),
                        graph_class=graph_class)

        facade.pack(expand=True, fill='both')
示例#15
0
    def __init__(self,
                 worldColor,
                 lightEnable,
                 ParticleEnable,
                 basedriveEnable,
                 collision,
                 backface,
                 texture,
                 wireframe,
                 grid,
                 widgetVis,
                 enableAutoCamera,
                 parent=None,
                 nodePath=render,
                 **kw):
        self.worldColor = worldColor
        self.lightEnable = lightEnable
        self.ParticleEnable = ParticleEnable
        self.basedriveEnable = basedriveEnable
        self.collision = collision
        self.backface = backface
        self.texture = texture
        self.wireframe = wireframe
        self.grid = grid
        self.enableAutoCamera = enableAutoCamera
        self.widgetVis = widgetVis

        # Define the megawidget options.
        optiondefs = (('title', self.appname, None), )
        self.defineoptions(kw, optiondefs)

        if parent == None:
            self.parent = Toplevel()
        else:
            self.parent = parent

        AppShell.__init__(self, self.parent)
        self.parent.geometry('%dx%d+%d+%d' %
                             (self.frameWidth, self.frameHeight,
                              self.frameIniPosX, self.frameIniPosY))

        self.parent.resizable(
            False, False)  ## Disable the ability to resize for this Window.
示例#16
0
    def __make_results_window(self):
        # wname = "results_window"
        self.results_window = Toplevel(self, name="results_window")
        self.results_window.protocol("WM_DELETE_WINDOW",
                                     self.__delete_results_window)
        self.results_window.bind("<Destroy>", self.__destroy_results_window)
        self.results_window.wm_title("Test Results")
        self.results_window.config(menu=self.menubar)

        self.results_save_button = Button(self.results_window,
                                          text="Save to File",
                                          command=self.save_to_file)
        self.results_save_button.pack()

        self.results_text = Text(self.results_window,
                                 state="normal",
                                 width="70",
                                 height="50")
        self.results_text.pack(fill="both", expand=True, padx=10)
示例#17
0
 def new_function(*args, **kwargs):
     """
     Create a queue, create a queuefun from original_function and make the
     new queuefun the target of a thread, passing the thread target
     original_function's args and kwargs. Then instantiate a new Tk Toplevel
     Frame called master and a new waitWidget with the queue and master.
     Start master's mainloop which exits when the original_function's
     results are fed to the queue. Destroy master and return the
     original_function's results.
     """
     queue = Queue.Queue()
     queuefun = setqueue(original_function, queue)
     thread = Thread(target=queuefun, args=args, kwargs=kwargs)
     thread.start()
     master = Toplevel()
     waitBox = waitWidget(queue, master)
     waitBox.mainloop()
     master.destroy()
     return queue.get()
示例#18
0
 def ancestranNetPipe(self):  #Interface
     top = Toplevel()
     top.title("NetworkComparer")
     a = open("NetComp.html", "r").readlines()
     self.queriesAC = []
     quera = 0
     for i in range(len(a)):
         if "START OF QUERIES" in a[i]:
             self.queryOrder = a[i + 1].rstrip().split()
         if "START OF VS. QUERY" in a[i]:
             quera = 1
         if quera == 1:
             self.queriesAC.append(a[i].rstrip().split("\t"))
     self.queriesAC = self.queriesAC[1:len(self.queriesAC) - 1]
     DescriptionLabel = LabelFrame(
         top, text="Select the gene of interest and specify parameters.")
     Description = Label(
         DescriptionLabel,
         text=
         "Select gene of interest from the list below.\nThis tool will generate netComp.html file containing a page similar to\nfirst step of NetworkComparer."
     )
     DescriptionLabel.grid(row=0, column=0)
     Description.grid(row=0)
     self.listbox = Listbox(DescriptionLabel,
                            width=40,
                            height=30,
                            exportselection=0,
                            selectmode=MULTIPLE)
     for gene in self.queriesAC:
         self.listbox.insert(
             END, gene[0] + '   ' + gene[1] + '   ' + gene[2] + '   ' +
             gene[3] + '   ' + gene[4])
     self.listbox.grid(row=1, column=0, rowspan=5, sticky=N + S + E + W)
     scrollbarG = Scrollbar(DescriptionLabel)
     scrollbarG.grid(row=1, column=1, rowspan=5, sticky=S + N)
     scrollbarG.config(command=self.listbox.yview)
     button = Button(top,
                     text="Calculate!",
                     fg="red",
                     font=("Courier", 22),
                     command=self.ancestralNet)
     button.grid(row=1, column=0, columnspan=5, sticky=E + W)
示例#19
0
def run():
    """
    Esegue l'emulatore del pdp8
    """
    CD = pdp8()
    principale = Tk()
    principale.title("Pdp8 Emulator : Assembly Editor")
    emulatore = Toplevel()
    emulatore.title("Pdp8 Emulator")
    emulatore.geometry("1015x589")

    edit = Editor(principale, CD)

    scrollbar1 = AutoScrollbar(emulatore)
    scrollbar1.grid(row=0, column=1, sticky=N + S)
    scrollbar2 = AutoScrollbar(emulatore, orient=HORIZONTAL)
    scrollbar2.grid(row=1, column=0, sticky=E + W)

    finestra = Canvas(emulatore,
                      yscrollcommand=scrollbar1.set,
                      xscrollcommand=scrollbar2.set)
    finestra.grid(row=0, column=0, sticky=N + S + E + W)

    scrollbar1.config(command=finestra.yview)
    scrollbar2.config(command=finestra.xview)

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

    emul = Emulatore(finestra, edit, CD, emulatore)

    finestra.create_window(0, 0, anchor=NW, window=emul.master)

    emul.master.update_idletasks()

    finestra.config(scrollregion=finestra.bbox("all"))

    principale.protocol("WM_DELETE_WINDOW", edit.exit)
    emulatore.protocol("WM_DELETE_WINDOW", emul.exit)

    principale.mainloop()
    emulatore.mainloop()
示例#20
0
文件: menu.py 项目: gilwoolee/bvhtool
    def commandlist(self):
        win = Toplevel()  # Creates an independent window
        t1 = " Camera control:"
        t2 = " a -- move camera left (strafe left)"
        t3 = " d -- move camera right (strafe right)"
        t4 = " s -- move camera back"
        t5 = " w -- move camera forward"
        t6 = " q -- rotate camera left"
        t7 = " e -- rotate camera right"
        t8 = " r -- move camera up"
        t9 = " f -- move camera down"
        t9a = "Hold down a key to trigger autorepeat."

        t10 = " Slider:"
        t11 = " Drag the slider left and right to scrub through keyframes."
        t12 = " The first frame is always frame 1 (there is no frame 0)."
        t12a = " You can also use the camera controls while you drag the slider."

        t13 = " Transport buttons:"
        t14 = " From left to right, the meanings of the buttons are as follows: "
        t15 = " -- Go to first frame of BVH sequence"
        t16 = " -- Step back 1 frame"
        t17 = " -- Stop"
        t18 = " -- Play"
        t19 = " -- Step forward 1 frame"
        t20 = " -- Go to last frame"

        t21 = " Window resize:"
        t22 = " Yes!  You can resize the application window and the animation"
        t23 = " display area will resize appropriately.  You can even resize"
        t24 = " during BVH playback."

        text1 = "\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s\n\n"   \
            % (t1,t2,t3,t4,t5,t6,t7,t8,t9,t9a)
        text2 = "%s\n%s\n%s\n%s\n\n" % (t10, t11, t12, t12a)
        text3 = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
            % (t13,t14,t15,t16,t17,t18,t19,t20)
        text4 = "\n%s\n%s\n%s\n%s\n" % (t21, t22, t23, t24)
        text = text1 + text2 + text3 + text4

        Button(win, text='Close', command=win.destroy).pack(side=BOTTOM)
        Label(win, text=text, anchor=W, justify=LEFT).pack(side=LEFT)
示例#21
0
    def nvnReport(self):  #interface for "Display probeset specific report"
        top = Toplevel()
        top.title("Co-expression analysis")
        self.genelist = []
        for string in self.queries:
            self.genelist.append(string.split())
        self.listbox = Listbox(top, width=40, height=30, exportselection=0)
        for gene in self.genelist:
            self.listbox.insert(END, gene[0] + '   ' + gene[1])

        DescriptionLabel = LabelFrame(top, text="Info")
        Description = Label(
            DescriptionLabel,
            text=
            "Select gene of interest from the list to the left.\nThis tool will generate result.html file containing a page similar to\ngene specific pages in PlaNet."
        )
        DescriptionLabel.grid(row=0, column=2)

        ParametersLabel = LabelFrame(top, text="Parameters")
        Steps = Label(ParametersLabel, text="Number of steps")
        ParametersLabel.grid(row=1, column=2)
        Hrr = Label(ParametersLabel, text="HRR cut-off.")

        self.paraSteps = Entry(ParametersLabel)
        self.paraSteps.grid(row=1)
        self.paraSteps.insert(END, 2)
        self.paraHrr = Entry(ParametersLabel)
        self.paraHrr.grid(row=3)
        self.paraHrr.insert(END, 30)
        Description.grid()
        Steps.grid(row=0)
        Hrr.grid(row=2)
        scrollbar = Scrollbar(top)
        scrollbar.grid(row=0, column=1, rowspan=5, sticky=S + N)
        self.listbox.grid(row=0, column=0, rowspan=5)
        scrollbar.config(command=self.listbox.yview)
        button = Button(top,
                        text="Calculate!",
                        fg="red",
                        font=("Courier", 22),
                        command=self.nvnReportPipe)
        button.grid(row=6, column=0)
示例#22
0
    def __init__(self):
        """Initialize the class

        Parameters:
        - self - This AddCatalogSourcesDialog object

        Return value:
        - none

        Description:
        This method simply creates the top level Tk window for holding the dialog box and
        initializes an empty dictionary to hold the return values.
        """
        self.win = Toplevel()
        self.win.title("Add Catalog Sources")
        #        self.win.minsize(500, 100)
        self.values = {}
        # need access to these outside their creation function
        self.l9 = Label()
        self.b7 = Button()
示例#23
0
    def __init__(self, parent, cfg=None, set_cfg_callback=None):
        self._parent = parent
        if cfg is not None: self._cfg = cfg
        else: self._cfg = ContextFreeGrammar(Nonterminal('S'), [])
        self._set_cfg_callback = set_cfg_callback

        self._highlight_matching_nonterminals = 1

        # Create the top-level window.
        self._top = Toplevel(parent)
        self._init_bindings()

        self._init_startframe()
        self._startframe.pack(side='top', fill='x', expand=0)
        self._init_prodframe()
        self._prodframe.pack(side='top', fill='both', expand=1)
        self._init_buttons()
        self._buttonframe.pack(side='bottom', fill='x', expand=0)

        self._textwidget.focus()
示例#24
0
    def create_text(self):
        self.notice_window = Toplevel(self.root)
        self.notice_window.title('Notice')
        self.notice_window.geometry('400x400+300+100')
        self.notice = Text(self.notice_window)
        self.notice.insert(
            Tkinter.INSERT,
            """Overwatch Replay Analyzer, a data extractor of Overwatch game replays

Copyright (C) 2017-2018 ORA developers

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.  If not, see <https://www.gnu.org/licenses/>.

You can contact the author or report issues by: https://github.com/appcell/OverwatchDataAnalysis/issues"""
        )
        self.notice.pack()
示例#25
0
    def about(self):
        """
        Simple TopLevel window displaying the authors
        """
        logger.info('Opening about window')
        file_window = Toplevel(self.__root)
        file_window.geometry("300x300")
        file_window.title('About')

        text = Text(file_window)
        text.insert(END, constants.ABOUT)
        text.config(state=DISABLED)
        text.pack(expand=True, fill=BOTH)

        button_close = Button(file_window,
                              text='Close',
                              command=file_window.destroy)
        button_close.pack()

        center(file_window, (300, 300))
示例#26
0
    def __createCanvas(self):
        """
        Create the canvas and draw all the spatial objects
        """
        self.canvasRoot = Toplevel()
        self.canvasRoot.title(self.attributeName)
        self.canvasRoot.lower(belowThis=self.root)
        self.mainCanvas = Canvas(self.canvasRoot,
                                 bg='black',
                                 width=canvasWidth + margin_x,
                                 height=canvasHeight + margin_y,
                                 scrollregion=('-50c', '-50c', "50c", "50c"))

        #Change by Sagar for Full Screen
        self.canvasRoot.state('zoomed')
        self.canvasRoot.geometry = ("1000x900+0+0")
        #Change End

        self.__drawShape()
        self.mainCanvas.pack()
示例#27
0
 def loginCommand(self, username, password):
     if self.gui.btd.database.login(username, password):
         self.gui.screenChange(welcomePage(self.root, self.gui))
     else:
         popup = Toplevel()
         popup.title("Incorrect")
         
         windowWidth = popup.winfo_screenwidth()
         windowHeight = popup.winfo_screenheight()
         
         width = .25 * windowWidth
         height = .1 * windowHeight
         x = (windowWidth - width) / 2
         y = (windowHeight - height) / 2
         
         popup.geometry("%dx%d+%d+%d" % (width, height, x, y))
         popup.update()
         
         Label(popup, text="Incorrect username or password!").pack()
         Button(popup, text="Dismiss", command=popup.destroy).pack()
示例#28
0
文件: NPUcat.py 项目: zmy235/NPUcat
 def create_ballon_tip(self, tip):
     try:    # Destory the last ballon window if it exists
         self.ballon_window.destroy()
     except:
         pass
     self.ballon_window = ballon_window = Toplevel(self.root)
     ballon_window.title(u'西工大的猫 1.3')
     ballon_window.resizable(False, False)
     ballon_window.attributes('-toolwindow', True)    # Set window style 
     lbl_msg = Label(ballon_window, text=tip, justify='left', fg='black')
     lbl_msg.grid(row=0,column=0, padx=20, pady=20)
     ballon_window.withdraw()    # Hide me
     ballon_window.after(1, ballon_window.update_idletasks())    # Calulate window size
     ballon_window.geometry('%sx%s+%s+%s' %
                            (ballon_window.winfo_width(), ballon_window.winfo_height(),
                             ballon_window.winfo_screenwidth() - ballon_window.winfo_width() - 16,
                             ballon_window.winfo_screenheight() - ballon_window.winfo_height() - 64 - 16
                             ))
     ballon_window.deiconify()
     self.tip_fade_in()
示例#29
0
    def about_window(self):
        """
        Window showing information about the software and
        version number, including auto-update. If the application
        is run from a container, then auto-update is disabled
        """
        def callback(event):
            """
            open webbrowser when clicking links
            """
            webbrowser.open_new(event.widget.cget("text"))

        # main window
        t = Toplevel(self.master, width=500, height=500)
        t.wm_title("About")

        # NIC logo + name
        title = Label(t,
                      text="nicMSlesions v" + self.version + "\n"
                      "Multiple Sclerosis White Matter Lesion Segmentation")
        title.grid(row=2, column=1, padx=20, pady=10)
        img = ImageTk.PhotoImage(Image.open('./logonic.png'))
        imglabel = Label(t, image=img)
        imglabel.image = img
        imglabel.grid(row=1, column=1, padx=10, pady=10)
        group_name = Label(t,
                           text="Copyright Sergi Valverde (2018-) \n " +
                           "NeuroImage Computing Group")
        group_name.grid(row=3, column=1)
        group_link = Label(t,
                           text=r"http://atc.udg.edu/nic",
                           fg="blue",
                           cursor="hand2")
        group_link.grid(row=4, column=1)
        group_link.bind("<Button-1>", callback)

        license_content = "Licensed under the BSD 2-Clause license. \n" + \
                          "A copy of the license is present in the root directory."

        license_label = Label(t, text=license_content)
        license_label.grid(row=5, column=1, padx=20, pady=20)
示例#30
0
    def __init__(self, master, enc):
        ## XXX ?
        from Tkinter import Toplevel, Text, Label, TOP, W, Entry, X, Frame, Button
        from Tkinter import LEFT, BOTH

        self.should_edit = False

        self.root = top = Toplevel(master)
        top.bind("<Return>", self.return_event)
        top.bind("<Escape>", self.do_ok)
        top.protocol("WM_DELETE_WINDOW", self.wm_delete_window)
        top.wm_title("I/O Warning")
        top.wm_iconname("I/O Warning")
        self.top = top

        l1 = Label(top,
            text="Non-ASCII found, yet no encoding declared. Add a line like")
        l1.pack(side=TOP, anchor=W)
        l2 = Entry(top, font="courier")
        l2.insert(0, "# -*- coding: %s -*-" % enc)
        # For some reason, the text is not selectable anymore if the
        # widget is disabled.
        # l2['state'] = DISABLED
        l2.pack(side=TOP, anchor = W, fill=X)
        l3 = Label(top, text="to your file\n"
                   "Choose OK to save this file as %s\n"
                   "Edit your general options to silence this warning" % enc)
        l3.pack(side=TOP, anchor = W)

        buttons = Frame(top)
        buttons.pack(side=TOP, fill=X)
        # Both return and cancel mean the same thing: do nothing
        self.default = self.cancel = 0
        b1 = Button(buttons, text="Ok", default="active",
                    command=self.do_ok)
        b1.pack(side=LEFT, fill=BOTH, expand=1)
        b2 = Button(buttons, text="Edit my file",
                    command=self.do_edit)
        b2.pack(side=LEFT, fill=BOTH, expand=1)

        self._set_transient(master)