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


Python tkwidget.MfxDialog类代码示例

本文整理汇总了Python中tkwidget.MfxDialog的典型用法代码示例。如果您正苦于以下问题:Python MfxDialog类的具体用法?Python MfxDialog怎么用?Python MfxDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, parent, title, app, player, gameid, **kw):
        self.app = app
        self.selected_game = None
        kw = self.initKw(kw)
        MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
        top_frame, bottom_frame = self.createFrames(kw)
        self.top_frame = top_frame
        self.createBitmaps(top_frame, kw)
        #
        self.player = player or _("Demo games")
        self.top.wm_minsize(200, 200)
        self.button = kw.default
        #
        ##createChart = self.create3DBarChart
        createChart = self.createPieChart
        ##createChart = self.createSimpleChart
##         if parent.winfo_screenwidth() < 800 or parent.winfo_screenheight() < 600:
##             createChart = self.createPieChart
##             createChart = self.createSimpleChart
        #
        self.font = self.app.getFont("default")
        self.tk_font = tkFont.Font(self.top, self.font)
        self.font_metrics = self.tk_font.metrics()
        self._calc_tabs()
        #
        won, lost = app.stats.getStats(player, gameid)
        createChart(app, won, lost, _("Total"))
        won, lost = app.stats.getSessionStats(player, gameid)
        createChart(app, won, lost, _("Current session"))
        #
        focus = self.createButtons(bottom_frame, kw)
        self.mainloop(focus, kw.timeout)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:32,代码来源:tkstats.py

示例2: __init__

 def __init__(self, parent, title, app, **kw):
     kw = self.initKw(kw)
     MfxDialog.__init__(self, parent, title, **kw)
     #
     top_box, bottom_box = self.createVBox()
     #
     label = gtk.Label('Please enter your name')
     label.show()
     top_box.pack_start(label)
     self.player_entry = gtk.Entry()
     self.player_entry.show()
     top_box.pack_start(self.player_entry, expand=False)
     completion = gtk.EntryCompletion()
     self.player_entry.set_completion(completion)
     model = gtk.ListStore(gobject.TYPE_STRING)
     for name in app.getAllUserNames():
         iter = model.append()
         model.set(iter, 0, name)
     completion.set_model(model)
     completion.set_text_column(0)
     self.player_entry.set_text(app.opt.player)
     #
     self.confirm_quit_check = gtk.CheckButton(_('Confirm quit'))
     self.confirm_quit_check.show()
     top_box.pack_start(self.confirm_quit_check)
     self.confirm_quit_check.set_active(app.opt.confirm != 0)
     #
     self.update_stats_check = gtk.CheckButton(_('Update statistics and logs'))
     self.update_stats_check.show()
     top_box.pack_start(self.update_stats_check)
     self.update_stats_check.set_active(app.opt.update_player_stats != 0)
     #
     self.createButtons(bottom_box, kw)
     self.show_all()
     gtk.main()
开发者ID:iske,项目名称:PySolFC,代码行数:35,代码来源:playeroptionsdialog.py

示例3: __init__

 def __init__(self, parent, title, text, **kw):
     kw = self.initKw(kw)
     MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
     top_frame, bottom_frame = self.createFrames(kw)
     self.createBitmaps(top_frame, kw)
     #
     self.text_w = Tkinter.Text(top_frame, bd=1, relief="sunken", wrap="word", width=64, height=16)
     self.text_w.pack(side="left", fill="both", expand=True)
     ###self.text_w.pack(side='top', padx=kw.padx, pady=kw.pady)
     vbar = Tkinter.Scrollbar(top_frame)
     vbar.pack(side="right", fill="y")
     self.text_w["yscrollcommand"] = vbar.set
     vbar["command"] = self.text_w.yview
     #
     self.text = ""
     if text:
         self.text = text
         old_state = self.text_w["state"]
         self.text_w.config(state="normal")
         self.text_w.insert("insert", self.text)
         self.text_w.config(state=old_state)
     #
     focus = self.createButtons(bottom_frame, kw)
     focus = self.text_w
     self.mainloop(focus, kw.timeout)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:25,代码来源:edittextdialog.py

示例4: __init__

    def __init__(self, parent, title, app, **kw):
        kw = self.initKw(kw)
        MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
        top_frame, bottom_frame = self.createFrames(kw)
        self.createBitmaps(top_frame, kw)

        frame = Tkinter.Frame(top_frame)
        frame.pack(expand=True, fill='both', padx=5, pady=10)
        frame.columnconfigure(0, weight=1)

        self.text_var = Tkinter.StringVar()
        self.text_var.set(app.opt.colors['text'])
        self.piles_var = Tkinter.StringVar()
        self.piles_var.set(app.opt.colors['piles'])
        self.cards_1_var = Tkinter.StringVar()
        self.cards_1_var.set(app.opt.colors['cards_1'])
        self.cards_2_var = Tkinter.StringVar()
        self.cards_2_var.set(app.opt.colors['cards_2'])
        self.samerank_1_var = Tkinter.StringVar()
        self.samerank_1_var.set(app.opt.colors['samerank_1'])
        self.samerank_2_var = Tkinter.StringVar()
        self.samerank_2_var.set(app.opt.colors['samerank_2'])
        self.hintarrow_var = Tkinter.StringVar()
        self.hintarrow_var.set(app.opt.colors['hintarrow'])
        self.not_matching_var = Tkinter.StringVar()
        self.not_matching_var.set(app.opt.colors['not_matching'])
        #
        row = 0
        for title, var in (
            (_('Text foreground:'),        self.text_var),
            (_('Highlight piles:'),        self.piles_var),
            (_('Highlight cards 1:'),      self.cards_1_var),
            (_('Highlight cards 2:'),      self.cards_2_var),
            (_('Highlight same rank 1:'),  self.samerank_1_var),
            (_('Highlight same rank 2:'),  self.samerank_2_var),
            (_('Hint arrow:'),             self.hintarrow_var),
            (_('Highlight not matching:'), self.not_matching_var),
            ):
            Tkinter.Label(frame, text=title, anchor='w',
                          ).grid(row=row, column=0, sticky='we')
            l = Tkinter.Label(frame, width=10, height=2,
                              bg=var.get(), textvariable=var)
            l.grid(row=row, column=1, padx=5)
            b = Tkinter.Button(frame, text=_('Change...'), width=10,
                               command=lambda l=l: self.selectColor(l))
            b.grid(row=row, column=2)
            row += 1
        #
        focus = self.createButtons(bottom_frame, kw)
        self.mainloop(focus, kw.timeout)
        #
        self.text_color = self.text_var.get()
        self.piles_color = self.piles_var.get()
        self.cards_1_color = self.cards_1_var.get()
        self.cards_2_color = self.cards_2_var.get()
        self.samerank_1_color = self.samerank_1_var.get()
        self.samerank_2_color = self.samerank_2_var.get()
        self.hintarrow_color = self.hintarrow_var.get()
        self.not_matching_color = self.not_matching_var.get()
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:59,代码来源:colorsdialog.py

示例5: mDone

 def mDone(self, button):
     self.selected_game = self.all_games_frame.getSelectedGame()
     w = self.notebook.select()
     indx = self.notebook_tabs.index(w)
     StatsDialog.SELECTED_TAB = indx
     if button == 500:               # "Reset..."
         assert indx in (0, 1)
         if indx == 0:               # "Current game"
             button = 302
         else:                       # "All games"
             button = 301
     MfxDialog.mDone(self, button)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:12,代码来源:tkstats.py

示例6: mDone

 def mDone(self, button):
     if button == 0:  # Ok or double click
         self.gameid = self.tree.selection_key
         self.tree.n_expansions = 1  # save xyview in any case
     if button == 1:  # Rules
         doc = self.app.getGameRulesFilename(self.tree.selection_key)
         if not doc:
             return
         dir = os.path.join("html", "rules")
         help_html(self.app, doc, dir, self.top)
         return
     MfxDialog.mDone(self, button)
开发者ID:shlomif,项目名称:PySolFC,代码行数:12,代码来源:selectgame.py

示例7: __init__

    def __init__(self, parent, title, app, **kw):
        kw = self.initKw(kw)
        MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
        top_frame, bottom_frame = self.createFrames(kw)
        #self.createBitmaps(top_frame, kw)

        frame = ttk.Frame(top_frame)
        frame.pack(expand=True, fill='both', padx=5, pady=10)
        frame.columnconfigure(0, weight=1)

        self.demo_sleep_var = Tkinter.DoubleVar()
        self.demo_sleep_var.set(app.opt.timeouts['demo'])
        self.hint_sleep_var = Tkinter.DoubleVar()
        self.hint_sleep_var.set(app.opt.timeouts['hint'])
        self.raise_card_sleep_var = Tkinter.DoubleVar()
        self.raise_card_sleep_var.set(app.opt.timeouts['raise_card'])
        self.highlight_piles_sleep_var = Tkinter.DoubleVar()
        self.highlight_piles_sleep_var.set(app.opt.timeouts['highlight_piles'])
        self.highlight_cards_sleep_var = Tkinter.DoubleVar()
        self.highlight_cards_sleep_var.set(app.opt.timeouts['highlight_cards'])
        self.highlight_samerank_sleep_var = Tkinter.DoubleVar()
        self.highlight_samerank_sleep_var.set(app.opt.timeouts['highlight_samerank'])
        #
        lframe = ttk.LabelFrame(frame, text=_('Set delays in seconds'),
                                 padding=(10, 5))
        lframe.pack(expand=True, fill='both', padx=4)
        row = 0
        for title, var in (
            (_('Demo:'),                self.demo_sleep_var),
            (_('Hint:'),                self.hint_sleep_var),
            (_('Raise card:'),          self.raise_card_sleep_var),
            (_('Highlight piles:'),     self.highlight_piles_sleep_var),
            (_('Highlight cards:'),     self.highlight_cards_sleep_var),
            (_('Highlight same rank:'), self.highlight_samerank_sleep_var),
            ):
            ttk.Label(lframe, text=title, anchor='w'
                       ).grid(row=row, column=0, sticky='we')
            widget = PysolScale(lframe, from_=0.2, to=9.9, value=var.get(),
                                resolution=0.1, orient='horizontal',
                                length="3i", variable=var, takefocus=0)
            widget.grid(row=row, column=1)
            row += 1
        #
        focus = self.createButtons(bottom_frame, kw)
        self.mainloop(focus, kw.timeout)
        #
        self.demo_timeout = self.demo_sleep_var.get()
        self.hint_timeout = self.hint_sleep_var.get()
        self.raise_card_timeout = self.raise_card_sleep_var.get()
        self.highlight_piles_timeout = self.highlight_piles_sleep_var.get()
        self.highlight_cards_timeout = self.highlight_cards_sleep_var.get()
        self.highlight_samerank_timeout = self.highlight_samerank_sleep_var.get()
开发者ID:iske,项目名称:PySolFC,代码行数:52,代码来源:timeoutsdialog.py

示例8: mDone

 def mDone(self, button):
     if button in (0, 1):               # Ok/Load
         self.key = self.tree.selection_key
         self.tree.n_expansions = 1  # save xyview in any case
     if button in (3, 4):
         cs = self.manager.get(self.tree.selection_key)
         if not cs:
             return
         ##title = CARDSET+" "+cs.name
         title = CARDSET.capitalize()+" "+cs.name
         CardsetInfoDialog(self.top, title=title, cardset=cs, images=self.preview_images)
         return
     MfxDialog.mDone(self, button)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:13,代码来源:selectcardset.py

示例9: __init__

    def __init__(self, parent, title, app, manager, key=None, **kw):
        kw = self.initKw(kw)
        MfxDialog.__init__(self, parent, title, **kw)
        #
        top_box, bottom_box = self.createHBox()
        #
        if key is None:
            key = manager.getSelected()
        self.app = app
        self.manager = manager
        self.key = key
        self.preview_key = -1
        self.all_keys = []

        if self._cardset_store is None:
            self._createStore()

        #padx, pady = kw.padx, kw.pady
        padx, pady = 5, 5
        # left
        # paned
        hpaned = gtk.HPaned()
        self.hpaned = hpaned
        hpaned.show()
        top_box.pack_start(hpaned, expand=True, fill=True)
        # tree
        treeview = PysolTreeView(self, self._cardset_store)
        self.treeview = treeview
        hpaned.pack1(treeview.scrolledwindow, True, True)
        ##treeview.treeview.expand_all()
        # right
        sw = gtk.ScrolledWindow()
        sw.show()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        hpaned.pack2(sw, True, True)
        ##self.scrolledwindow = sw
        #
        self.preview = MfxCanvas(self)
        self.preview.show()
        sw.add(self.preview)
        #hpaned.pack2(self.preview, True, True)
        self.preview.setTile(app, app.tabletile_index, force=True)
        #
        hpaned.set_position(240)

        self.createButtons(bottom_box, kw)

        ##~self.updatePreview(key)

        self.show_all()
        gtk.main()
开发者ID:iske,项目名称:PySolFC,代码行数:51,代码来源:selectcardset.py

示例10: __init__

    def __init__(self, parent, title, app, **kw):
        kw = self.initKw(kw)
        MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
        top_frame, bottom_frame = self.createFrames(kw)
        # self.createBitmaps(top_frame, kw)

        frame = Tkinter.Frame(top_frame)
        frame.pack(expand=True, fill="both", padx=5, pady=10)
        frame.columnconfigure(0, weight=1)

        self.demo_sleep_var = Tkinter.DoubleVar()
        self.demo_sleep_var.set(app.opt.timeouts["demo"])
        self.hint_sleep_var = Tkinter.DoubleVar()
        self.hint_sleep_var.set(app.opt.timeouts["hint"])
        self.raise_card_sleep_var = Tkinter.DoubleVar()
        self.raise_card_sleep_var.set(app.opt.timeouts["raise_card"])
        self.highlight_piles_sleep_var = Tkinter.DoubleVar()
        self.highlight_piles_sleep_var.set(app.opt.timeouts["highlight_piles"])
        self.highlight_cards_sleep_var = Tkinter.DoubleVar()
        self.highlight_cards_sleep_var.set(app.opt.timeouts["highlight_cards"])
        self.highlight_samerank_sleep_var = Tkinter.DoubleVar()
        self.highlight_samerank_sleep_var.set(app.opt.timeouts["highlight_samerank"])
        #
        # Tkinter.Label(frame, text='Set delays in seconds').grid(row=0, column=0, columnspan=2)
        row = 0
        for title, var in (
            (_("Demo:"), self.demo_sleep_var),
            (_("Hint:"), self.hint_sleep_var),
            (_("Raise card:"), self.raise_card_sleep_var),
            (_("Highlight piles:"), self.highlight_piles_sleep_var),
            (_("Highlight cards:"), self.highlight_cards_sleep_var),
            (_("Highlight same rank:"), self.highlight_samerank_sleep_var),
        ):
            Tkinter.Label(frame, text=title, anchor="w").grid(row=row, column=0, sticky="we")
            widget = Tkinter.Scale(
                frame, from_=0.2, to=9.9, resolution=0.1, orient="horizontal", length="3i", variable=var, takefocus=0
            )
            widget.grid(row=row, column=1)
            row += 1
        #
        focus = self.createButtons(bottom_frame, kw)
        self.mainloop(focus, kw.timeout)
        #
        self.demo_timeout = self.demo_sleep_var.get()
        self.hint_timeout = self.hint_sleep_var.get()
        self.raise_card_timeout = self.raise_card_sleep_var.get()
        self.highlight_piles_timeout = self.highlight_piles_sleep_var.get()
        self.highlight_cards_timeout = self.highlight_cards_sleep_var.get()
        self.highlight_samerank_timeout = self.highlight_samerank_sleep_var.get()
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:49,代码来源:timeoutsdialog.py

示例11: initKw

 def initKw(self, kw):
     kwdefault(kw,
               strings=(_("&Select"), _("&Rules"), _("&Cancel"),),
               default=0,
               width=600, height=400,
               )
     return MfxDialog.initKw(self, kw)
开发者ID:iske,项目名称:PySolFC,代码行数:7,代码来源:selectgame.py

示例12: initKw

 def initKw(self, kw):
     kw = KwStruct(kw,
                   strings=(None, None, _("&Cancel"),), default=0,
                   resizable=True,
                   separator=True,
                   )
     return MfxDialog.initKw(self, kw)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:7,代码来源:selectgame.py

示例13: initKw

 def initKw(self, kw):
     strings=[_("&OK"), _("&Apply"), _("&Cancel"),]
     kw = KwStruct(kw,
                   strings=strings,
                   default=0,
                   )
     return MfxDialog.initKw(self, kw)
开发者ID:TrevorLowing,项目名称:PyGames,代码行数:7,代码来源:soundoptionsdialog.py

示例14: initKw

 def initKw(self, kw):
     kw = KwStruct(kw,
                   strings=(_('&OK'), _('&Cancel')),
                   default=0,
                   separator=False,
                   )
     return MfxDialog.initKw(self, kw)
开发者ID:iske,项目名称:PySolFC,代码行数:7,代码来源:wizarddialog.py

示例15: initKw

 def initKw(self, kw):
     kw = KwStruct(kw,
                   strings=(_("&OK"),),
                   default=0,
                   separator=True,
                   )
     return MfxDialog.initKw(self, kw)
开发者ID:iske,项目名称:PySolFC,代码行数:7,代码来源:gameinfodialog.py


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