当前位置: 首页>>代码示例>>Python>>正文


Python Button.grid方法代码示例

本文整理汇总了Python中tkinter.ttk.Button.grid方法的典型用法代码示例。如果您正苦于以下问题:Python Button.grid方法的具体用法?Python Button.grid怎么用?Python Button.grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.ttk.Button的用法示例。


在下文中一共展示了Button.grid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    def __init__(self, title):
        root = Tk()
        root.title(title)
        root.focus_set()
        root.rowconfigure(0, weight=0)
        root.columnconfigure(0, weight=1)
        root.rowconfigure(1, weight=1)
        self._root = root

        self.menubar = Frame(root)
        self.menubar.grid(row=0, column=0, sticky=(W, E))
        self.menubar['takefocus'] = False

        quit_button = Button(self.menubar, text='Quit', command=self.quit)
        quit_button.grid(row=0, column=0)

        self._menucolumn = 1
        self.views = list()

        self.paned_win = PanedWindow(root, orient=HORIZONTAL)
        self.paned_win.grid(row=1, column=0, sticky=(N, S, W, E))

        self._query = None
        self._accept_func = None

        self.sidebar_views = dict()
        self.sidebar_count = 0
        self.sidebar = PanedWindow(self.paned_win)
        self.paned_win.add(self.sidebar, weight=1)
        
        self.tabs = Notebook(self.paned_win)
        self.tabs.enable_traversal()
        self.paned_win.add(self.tabs, weight=5)
        self.root = self.tabs
开发者ID:gokai,项目名称:tim,代码行数:36,代码来源:mainview.py

示例2: MainApplication

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
class MainApplication(Frame):
    def __init__(self, parent, *args, **kwargs):
        Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        self.button = Button(self, text="start", command=self.callback)
        self.cancel = Button(self, text="cancel", command=self.cancel)

        self.button.grid(row=0, column=0)
        self.cancel.grid(row=0, column=1)

        self.is_canceled = False

    def check_status(self):
        if self.proc.is_alive():
            self.after(100, self.check_status)
        elif self.is_canceled:
            messagebox.showinfo(message="canceled")
        else:
            messagebox.showinfo(message="finished" +
                                int(self.result_queue.get()))

    def callback(self):
        self.result_queue = Queue()
        self.proc = CalculationProcess(self.result_queue)
        self.proc.start()
        self.after(10, self.check_status)

    def cancel(self):
        self.is_canceled = True
        self.proc.terminate()
开发者ID:terasakisatoshi,项目名称:PythonCode,代码行数:33,代码来源:single_app_with_cancel_function.py

示例3: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
 def __init__(self, master, ordinances=False, **kwargs):
     super(Options, self).__init__(master, **kwargs)
     self.ancestors = IntVar()
     self.ancestors.set(4)
     self.descendants = IntVar()
     self.spouses = IntVar()
     self.ordinances = IntVar()
     self.contributors = IntVar()
     self.start_indis = StartIndis(self)
     self.fid = StringVar()
     btn = Frame(self)
     entry_fid = EntryWithMenu(btn, textvariable=self.fid, width=16)
     entry_fid.bind('<Key>', self.enter)
     label_ancestors = Label(self, text=_('Number of generations to ascend'))
     entry_ancestors = EntryWithMenu(self, textvariable=self.ancestors, width=5)
     label_descendants = Label(self, text=_('Number of generations to descend'))
     entry_descendants = EntryWithMenu(self, textvariable=self.descendants, width=5)
     btn_add_indi = Button(btn, text=_('Add a FamilySearch ID'), command=self.add_indi)
     btn_spouses = Checkbutton(self, text='\t' + _('Add spouses and couples information'), variable=self.spouses)
     btn_ordinances = Checkbutton(self, text='\t' + _('Add Temple information'), variable=self.ordinances)
     btn_contributors = Checkbutton(self, text='\t' + _('Add list of contributors in notes'), variable=self.contributors)
     self.start_indis.grid(row=0, column=0, columnspan=3)
     entry_fid.grid(row=0, column=0, sticky='w')
     btn_add_indi.grid(row=0, column=1, sticky='w')
     btn.grid(row=1, column=0, columnspan=2, sticky='w')
     entry_ancestors.grid(row=2, column=0, sticky='w')
     label_ancestors.grid(row=2, column=1, sticky='w')
     entry_descendants.grid(row=3, column=0, sticky='w')
     label_descendants.grid(row=3, column=1, sticky='w')
     btn_spouses.grid(row=4, column=0, columnspan=2, sticky='w')
     if ordinances:
         btn_ordinances.grid(row=5, column=0, columnspan=3, sticky='w')
     btn_contributors.grid(row=6, column=0, columnspan=3, sticky='w')
     entry_ancestors.focus_set()
开发者ID:daleathan,项目名称:getmyancestors,代码行数:36,代码来源:fstogedcom.py

示例4: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
 def __init__(self, parent, process):
     super(ProcessWindow, self).__init__(parent)
     self.parent = parent
     self.process = process
     terminate_button = Button(self, text="cancel", command=self.cancel)
     terminate_button.grid(row=0, column=0)
     self.grab_set()  # so you can't push submit multiple times
开发者ID:terasakisatoshi,项目名称:PythonCode,代码行数:9,代码来源:multiprocess_window.py

示例5: initUI

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    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)
开发者ID:HarryTheBadger,项目名称:TWBatMan,代码行数:62,代码来源:ui.py

示例6: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
 def __init__(self, parent, title, imageFile, body):
     super(DialogAbout, self).__init__(parent)
     self.parent = parent
     parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
     dialogX = int(parentGeometry.group(3))
     dialogY = int(parentGeometry.group(4))
     self.transient(self.parent)
     self.title(title)
     
     frame = Frame(self)
     image = PhotoImage(file=imageFile)
     aboutImage = Label(frame, image=image)
     aboutBody = Label(frame, text=body, wraplength=500)
     okButton = Button(frame, text=_("OK"), command=self.ok)
     okButton.focus_set()
     aboutImage.grid(row=0, column=0, sticky=NW, pady=20, padx=16)
     aboutBody.grid(row=0, column=1, columnspan=2, sticky=EW, pady=3, padx=0)
     okButton.grid(row=1, column=2, sticky=EW, pady=3)
     
     frame.grid(row=0, column=0, sticky=(N,S,E,W))
     frame.columnconfigure(1, weight=1)
     window = self.winfo_toplevel()
     window.columnconfigure(0, weight=1)
     self.geometry("+{0}+{1}".format(dialogX+200,dialogY+200))
     
     self.bind("<Alt-u>", lambda *ignore: okButton.focus_set())
     self.bind("<Return>", self.ok)
     self.bind("<Escape>", self.close)
     
     self.protocol("WM_DELETE_WINDOW", self.close)
     self.grab_set()
     self.wait_window(self)
开发者ID:DaveInga,项目名称:Arelle,代码行数:34,代码来源:DialogAbout.py

示例7: sphinxDialogRssWatchFileChoices

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
def sphinxDialogRssWatchFileChoices(dialog, frame, row, options, cntlr, openFileImage, openDatabaseImage, *args, **kwargs):
    from tkinter import PhotoImage, N, S, E, W
    try:
        from tkinter.ttk import Button
    except ImportError:
        from ttk import Button
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label
    # add sphinx formulas to RSS dialog
    def chooseSphinxFiles():
        sphinxFilesList = cntlr.uiFileDialog("open",
                multiple=True,  # expect multiple sphinx files
                title=_("arelle - Select sphinx rules file"),
                initialdir=cntlr.config.setdefault("rssWatchSphinxRulesFilesDir","."),
                filetypes=[(_("Sphinx files .xsr"), "*.xsr"), (_("Sphinx archives .xrb"), "*.xrb")],
                defaultextension=".xsr")
        if sphinxFilesList:
            dialog.options["rssWatchSphinxRulesFilesDir"] = os.path.dirname(sphinxFilesList[0])
            sphinxFilesPipeSeparated = '|'.join(sphinxFilesList)
            dialog.options["sphinxRulesFiles"] = sphinxFilesPipeSeparated
            dialog.cellSphinxFiles.setValue(sphinxFilesPipeSeparated)
        else:  # deleted
            dialog.options.pop("sphinxRulesFiles", "")  # remove entry
    label(frame, 1, row, "Sphinx rules:")
    dialog.cellSphinxFiles = gridCell(frame,2, row, options.get("sphinxRulesFiles",""))
    ToolTip(dialog.cellSphinxFiles, text=_("Select a sphinx rules (file(s) or archive(s)) to to evaluate each filing.  "
                                           "The results are recorded in the log file.  "), wraplength=240)
    chooseFormulaFileButton = Button(frame, image=openFileImage, width=12, command=chooseSphinxFiles)
    chooseFormulaFileButton.grid(row=row, column=3, sticky=W)
开发者ID:Arelle,项目名称:Arelle,代码行数:31,代码来源:__init__.py

示例8: create_widgets

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    def create_widgets(self, clear_all_fnc):
        ''' Creates widgets of this frame.

            Args:
                clear_all_fnc (function): function that should be called when
                    "Clear all" button is pressed.
        '''
        rows_spinbox = Spinbox(self, from_=1, to=100, width=3,
                               textvariable=self.row_str_var)
        rows_spinbox.grid(row=0, column=0, pady=3, padx=3)
        add_row_btn = Button(self, text='Add row(s)', command=self.add_rows)
        add_row_btn.grid(row=0, column=1, sticky=N+E+W, pady=3)
        remove_row_btn = Button(self, text='Remove row(s)',
                                command=self.remove_rows)
        remove_row_btn.grid(row=1, column=1, sticky=N+E+W, pady=3)
        columns_spinbox = Spinbox(self, from_=1, to=100, width=3,
                                  textvariable=self.col_str_var)
        columns_spinbox.grid(row=2, column=0, pady=3, padx=3)
        add_column_btn = Button(self, text='Add column(s)',
                                command=self.add_columns)
        add_column_btn.grid(row=2, column=1, sticky=N+E+W, pady=3)
        remove_column_btn = Button(self, text='Remove column(s)',
                                   command=self.remove_columns)
        remove_column_btn.grid(row=3, column=1, sticky=N+E+W, pady=3)
        clear_all_btn = Button(self, text='Clear all', command=clear_all_fnc)
        clear_all_btn.grid(row=4, column=1, sticky=N+E+W, pady=3)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:28,代码来源:table_modifier_gui.py

示例9: dialogRssWatchDBextender

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
def dialogRssWatchDBextender(dialog, frame, row, options, cntlr, openFileImage, openDatabaseImage):
    from tkinter import PhotoImage, N, S, E, W
    from tkinter.simpledialog import askstring
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label
    try:
        from tkinter.ttk import Button
    except ImportError:
        from ttk import Button
        
    def enterConnectionString():
        from arelle.DialogUserPassword import askDatabase
        # (user, password, host, port, database)
        db = askDatabase(cntlr.parent, dialog.cellDBconnection.value.split(',') if dialog.cellDBconnection.value else None)
        if db:
            dbConnectionString = ','.join(db)
            dialog.options["xbrlDBconnection"] = dbConnectionString 
            dialog.cellDBconnection.setValue(dbConnectionString)
        else:  # deleted
            dialog.options.pop("xbrlDBconnection", "")  # remove entry
    label(frame, 1, row, "DB Connection:")
    dialog.cellDBconnection = gridCell(frame,2, row, options.get("xbrlDBconnection",""))
    ToolTip(dialog.cellDBconnection, text=_("Enter an XBRL Database (Postgres) connection string.  "
                                           "E.g., host,port,user,password,db[,timeout].  "), wraplength=240)
    enterDBconnectionButton = Button(frame, image=openDatabaseImage, width=12, command=enterConnectionString)
    enterDBconnectionButton.grid(row=row, column=3, sticky=W)
开发者ID:Arelle,项目名称:Arelle,代码行数:28,代码来源:DialogRssWatchExtender.py

示例10: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
 def __init__(self, title="", message="", button="Ok", image=None,
              checkmessage="", style="clam", **options):
     """
         Create a messagebox with one button and a checkbox below the button:
             parent: parent of the toplevel window
             title: message box title
             message: message box text
             button: message displayed on the button
             image: image displayed at the left of the message
             checkmessage: message displayed next to the checkbox
             **options: other options to pass to the Toplevel.__init__ method
     """
     Tk.__init__(self, **options)
     self.resizable(False, False)
     self.title(title)
     s = Style(self)
     s.theme_use(style)
     if image:
         Label(self, text=message, wraplength=335,
               font="Sans 11", compound="left",
               image=image).grid(row=0, padx=10, pady=(10, 0))
     else:
         Label(self, text=message, wraplength=335,
               font="Sans 11").grid(row=0, padx=10, pady=(10, 0))
     b = Button(self, text=button, command=self.destroy)
     b.grid(row=2, padx=10, pady=10)
     self.var = BooleanVar(self)
     c = Checkbutton(self, text=checkmessage, variable=self.var)
     c.grid(row=1, padx=10, pady=0, sticky="e")
     self.grab_set()
     b.focus_set()
     self.wait_window(self)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:34,代码来源:custom_messagebox.py

示例11: OkFrame

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
class OkFrame(MessageFrame):
    def __init__(self, master, config):
        super(OkFrame, self).__init__(master, config)

        if config.full_screen:
            self._make_full(master)

        self.master.grid_rowconfigure(0, weight=1)
        self.master.grid_rowconfigure(1, weight=1)
        self.master.grid_columnconfigure(0, weight=1)

        self._frame_lbl = Label(
            self.master,
            text='',
            anchor='center',
            font=self._config.item_font
        )
        self._frame_lbl.grid(row=0, column=0, sticky='snew')

        self._next_btn = Button(
            self.master,
            text='OK',
            command=self._next_cmd
        )
        self._next_btn.grid(row=1, column=0, sticky='snew')

    def show(master, config, msg):
        new_window = Toplevel(master)
        dlg = OkFrame(new_window, config)
        dlg._frame_lbl['text'] = msg

    def _next_cmd(self):
        self._master.destroy()
开发者ID:aphistic,项目名称:copilot,代码行数:35,代码来源:message.py

示例12: add_file_info_box

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    def add_file_info_box(self, mainframe, name, labeldict, btncallback, fvar):
        """
        Create and add a infobox containing the info about a loaded
        savegame.
        """
        title = {'source':'Copy face from source file:',
                 'target':'To target file:'}
        frame = LabelFrame(mainframe, text=title[name])
        frame.pack(anchor=N, fill=X, expand=1, side=TOP, padx=0, pady=0)
        frame.columnconfigure(1, weight=1)

        btn = Button(frame, text='Browse', command=btncallback)
        btn.grid(column=0, row=0, padx=2, pady=2)

        field = Entry(frame, width=50, textvariable=fvar)
        field.grid(column=1, row=0, columnspan=2, padx=2, pady=2, sticky=W+E)

        l = ('name','gender','level','race','location','save number','playing time')
        for n, (i, j) in enumerate([(x.capitalize()+':', x) for x in l]):
            Label(frame, text=i, state=DISABLED).grid(column=0, row=n+1, padx=4,
                                                      pady=3, sticky=E)
            labeldict[j] = StringVar()
            Label(frame, textvariable=labeldict[j]).grid(column=1, row=n+1,
                                                     padx=4, pady=3, sticky=W)
        self.screenshot[name] = Label(frame)
        self.screenshot[name].grid(column=2, row=1, rowspan=len(l),
                                   padx=4, pady=4)
开发者ID:luckydonald-forks,项目名称:FaceTransfer,代码行数:29,代码来源:facetransfer.py

示例13: create_widgets

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    def create_widgets(self):
        ''' Creates appropriate widgets on this frame.
        '''
        self.columnconfigure(0, weight=1)
        self.rowconfigure(3, weight=1)
        frame_for_save_btn = Frame(self)
        frame_for_save_btn.columnconfigure(1, weight=1)
        self.status_lbl = Label(frame_for_save_btn, text='')
        self.status_lbl.grid(row=0, column=1, sticky=N+W)
        save_solution_btn = Button(frame_for_save_btn, text='Save solution',
                                   command=self.on_save_solution)
        save_solution_btn.grid(row=1, column=0, sticky=W+N, padx=5, pady=5)
        self.progress_bar = Progressbar(frame_for_save_btn,
                                        mode='determinate', maximum=100)
        self.progress_bar.grid(row=1, column=1, sticky=W+E, padx=10, pady=5)

        frame_for_save_btn.grid(sticky=W+N+E+S, padx=5, pady=5)

        frame_for_btns = Frame(self)
        self._create_file_format_btn('*.xlsx', 1, frame_for_btns, 0)
        self._create_file_format_btn('*.xls', 2, frame_for_btns, 1)
        self._create_file_format_btn('*.csv', 3, frame_for_btns, 2)
        self.solution_format_var.set(1)

        frame_for_btns.grid(row=1, column=0, sticky=W+N+E+S, padx=5, pady=5)
        self.data_from_file_lbl = Label(self, text=TEXT_FOR_FILE_LBL, anchor=W,
                                        justify=LEFT,
                                        wraplength=MAX_FILE_PARAMS_LBL_LENGTH)
        self.data_from_file_lbl.grid(row=2, column=0, padx=5, pady=5,
                                     sticky=W+N)

        self.solution_tab = SolutionFrameWithText(self)
        self.solution_tab.grid(row=3, column=0, sticky=W+E+S+N, padx=5, pady=5)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:35,代码来源:solution_tab_frame_gui.py

示例14: Window

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
class Window(Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.master.resizable(False, False)
        self.master.title('The Game of Life')
        self.pack()

        self.button_start = Button(self, text='Start', command=self.button_start)
        self.button_start.grid(row=1, column=1, padx=8, pady=8)

        Button(self, text='Reset', command=self.button_reset).grid(row=2, column=1)

        self.world = World(self, 60, on_stop=self.button_start_text_reset)
        self.world.grid(row=1, column=2, rowspan=50)

    def button_start_text_reset(self):
        self.button_start['text'] = 'Start'

    def button_start(self):
        if self.world.simulation:
            self.world.stop()
            self.button_start_text_reset()
        else:
            self.world.start()
            self.button_start['text'] = 'Stop'

    def button_reset(self):
        self.world.stop()
        self.world.clear()
        self.button_start_text_reset()
开发者ID:linsdev,项目名称:pylife,代码行数:33,代码来源:life.py

示例15: __init__

# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import grid [as 别名]
    def __init__(self, mainWin, options):
        self.mainWin = mainWin
        parent = mainWin.parent
        super(DialogNewFactItemOptions, self).__init__(parent)
        self.parent = parent
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

        self.transient(self.parent)
        self.title(_("New Fact Item Options"))
        
        frame = Frame(self)

        label(frame, 1, 1, "Entity scheme:")
        self.cellEntityIdentScheme = gridCell(frame, 2, 1, getattr(options,"entityIdentScheme",""), width=50)
        ToolTip(self.cellEntityIdentScheme, text=_("Enter the scheme for the context entity identifier"), wraplength=240)
        label(frame, 1, 2, "Entity identifier:")
        self.cellEntityIdentValue = gridCell(frame, 2, 2, getattr(options,"entityIdentValue",""))
        ToolTip(self.cellEntityIdentValue, text=_("Enter the entity identifier value (e.g., stock ticker)"), wraplength=240)
        label(frame, 1, 3, "Start date:")
        startDate = getattr(options,"startDate",None)
        self.cellStartDate = gridCell(frame, 2, 3, XmlUtil.dateunionValue(startDate) if startDate else "")
        ToolTip(self.cellStartDate, text=_("Enter the start date for the report period (e.g., 2010-01-01)"), wraplength=240)
        label(frame, 1, 4, "End date:")
        endDate = getattr(options,"endDate",None)
        self.cellEndDate = gridCell(frame, 2, 4, XmlUtil.dateunionValue(endDate, subtractOneDay=True) if endDate else "")
        ToolTip(self.cellEndDate, text=_("Enter the end date for the report period (e.g., 2010-12-31)"), wraplength=240)
        label(frame, 1, 5, "Monetary unit:")
        self.cellMonetaryUnit = gridCombobox(frame, 2, 5, getattr(options,"monetaryUnit",""), values=monetaryUnits)
        ToolTip(self.cellMonetaryUnit, text=_("Select a monetary unit (e.g., EUR)"), wraplength=240)
        label(frame, 1, 6, "Monetary decimals:")
        self.cellMonetaryDecimals = gridCell(frame, 2, 6, getattr(options,"monetaryDecimals","2"))
        ToolTip(self.cellMonetaryDecimals, text=_("Enter decimals for monetary items"), wraplength=240)
        label(frame, 1, 7, "Non-monetary decimals:")
        self.cellNonMonetaryDecimals = gridCell(frame, 2, 7, getattr(options,"nonMonetaryDecimals","0"))
        ToolTip(self.cellNonMonetaryDecimals, text=_("Enter decimals for non-monetary items (e.g., stock shares)"), wraplength=240)

        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        ToolTip(cancelButton, text=_("Cancel operation, discarding changes and entries"))
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Accept the options as entered above"))
        cancelButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=3)
        okButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=86)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(2, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        
        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)
        
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
开发者ID:jaolguin,项目名称:Arelle,代码行数:61,代码来源:DialogNewFactItem.py


注:本文中的tkinter.ttk.Button.grid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。