def __init__(self, x, y, game, max_rounds=1, num_deal=1, **cap): kwdefault(cap, max_move=1, max_accept=1, max_cards=999999) Stack.__init__(self, x, y, game, cap=cap) self.max_rounds = max_rounds self.num_deal = num_deal self.round = 1 self.base_cards = [] # for DealBaseCard_StackMethods
def createGame(self, max_rounds=2, num_deal=1, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=7, waste=1, playcards=20) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create talon s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) # Create foundations for r in l.s.foundations[:4]: s.foundations.append(self.Foundation_Class(r.x, r.y, self, r.suit, mod=16, max_cards=16, max_move=1)) r = l.s.foundations[4] s.foundations.append(HexATrump_Foundation(r.x, r.y, self, 4, mod=4, max_move=0, max_cards=4, base_rank=ANY_RANK)) # Create rows for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self, suit=ANY_SUIT, base_rank=ANY_RANK)) # Define stack groups l.defaultAll()
def initKw(self, kw): kwdefault(kw, strings=(_("&Select"), _("&Rules"), _("&Cancel"),), default=0, width=600, height=400, ) return MfxDialog.initKw(self, kw)
def __init__(self, parent, hbar=True, vbar=True, propagate=False, **kw): kwdefault(kw, highlightthickness=0, bd=1, relief='sunken') self.parent = parent # workarea = parent.getWork() print('MfxScrolledCanvas: parent=%s' % (parent)) super(MfxScrolledCanvas, self).__init__() self.createFrame(kw) self.canvas = None # do_scroll_x = None # do_scroll_y = None # self.hbar = None # self.vbar = None self.hbar_show = False self.vbar_show = False self.createCanvas(kw) # self.frame.grid_rowconfigure(0, weight=1) # self.frame.grid_columnconfigure(0, weight=1) # self.frame.grid_propagate(propagate) if hbar: self.createHbar() self.bindHbar() if vbar: self.createVbar() self.bindVbar()
def createGame(self, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=14, reserves=4, texts=0) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create foundations for r in l.s.foundations: s.foundations.append( self.Foundation_Class( r.x, r.y, self, r.suit, mod=12, max_cards=12)) # Create reserve stacks for r in l.s.reserves: s.reserves.append(ReserveStack(r.x, r.y, self, )) # Create row stacks for r in l.s.rows: s.rows.append( self.RowStack_Class( r.x, r.y, self, max_cards=12, suit=ANY_SUIT, base_rank=self.BASE_RANK)) # Create talon s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) # Define stack groups l.defaultAll()
def createGame(self, max_rounds=1, num_deal=1, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=8, waste=1) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create talon s.talon = self.Talon_Class( l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) # Create foundations for r in l.s.foundations: s.foundations.append( self.Foundation_Class( r.x, r.y, self, r.suit, mod=12, max_cards=12, max_move=self.MAX_MOVE)) # Create row stacks for r in l.s.rows: s.rows.append( self.RowStack_Class( r.x, r.y, self, suit=ANY_SUIT, base_rank=self.BASE_RANK)) # Define stack groups l.defaultAll()
def createGame(self, max_rounds=2, num_deal=1, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=12, waste=1, playcards=20) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create talon s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) # Create foundations for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, r.suit, mod=16, max_cards=16, max_move=1)) # Create rows for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self, suit=ANY_SUIT, base_rank=15)) # Create reserve x, y = l.XM, self.height - l.YS s.reserves.append(Familiar_ReserveStack(x, y, self, max_cards=3)) self.setRegion(s.reserves, (-999, y - l.YM, x + l.XS, 999999), priority=1) l.createText(s.reserves[0], "se") # Define stack groups l.defaultAll()
def __init__(self, x, y, game, yoffset=-1, **cap): kwdefault( cap, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1) OpenStack.__init__(self, x, y, game, **cap) if yoffset < 0: yoffset = game.app.images.CARD_YOFFSET self.CARD_YOFFSET = yoffset
def initKw(self, kw): kwdefault(kw, strings=(_('&OK'), _('&Solid color...'), _('&Cancel'),), default=0, resizable=1, padx=10, pady=10, width=600, height=400, ) return MfxDialog.initKw(self, kw)
def initKw(self, kw): kwdefault(kw, strings=(_("&Load"), _("&Cancel"), _("&Info..."),), default=1, resizable=1, padx=10, pady=10, width=600, height=400, ) return MfxDialog.initKw(self, kw)
def initKw(self, kw): kwdefault(kw, strings=(_('&OK'), _('&Cancel'),), default=0, #resizable=1, padx=10, pady=10, #width=600, height=400, ##~ buttonpadx=10, buttonpady=5, ) return MfxDialog.initKw(self, kw)
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=13, playcards=9) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) # default l.defaultAll() return l
def createGame(self, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=10, reserves=4, texts=0, playcards=20) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit, base_rank=3)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self, yoffset=l.YOFFSET)) for r in l.s.reserves: s.reserves.append(ReserveStack(r.x, r.y, self)) l.defaultAll()
def createGame(self, max_rounds=-1, num_deal=3, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=self.Rows, waste=1, texts=1, playcards=self.PlayCards) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=ANY_SUIT, base_rank=r.suit)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self, yoffset=l.YOFFSET)) l.defaultAll()
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=10, reserves=2, texts=0) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = InitialDealTalonStack(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: self.s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) for r in l.s.reserves: self.s.reserves.append(ReserveStack(r.x, r.y, self)) # default l.defaultAll()
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=10, waste=0, texts=1, playcards=23) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) if l.s.waste: s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=ANY_SUIT)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) # default l.defaultAll()
def initKw(self, kw): kwdefault(kw, timeout=0, resizable=0, text="", justify="center", strings=(_("&OK"),), default=0, width=0, padx=20, pady=20, bitmap=None, bitmap_side="left", bitmap_padx=10, bitmap_pady=20, image=None, image_side="left", image_padx=10, image_pady=20, ) # # default to separator if more than one button # sw = len(kw.strings) > 1 # kwdefault(kw.__dict__, separator=sw) return kw
def __init__(self, parent, title, app, player, **kw): lines = 25 # if parent and parent.winfo_screenheight() < 600: # lines = 20 # self.font = app.getFont(self.FONT_TYPE) font = tkinter_font.Font(parent, self.font) self.font_metrics = font.metrics() self.CHAR_H = self.font_metrics['linespace'] self.CHAR_W = font.measure('M') self.app = app # self.player = player self.title = title self.sort_by = 'name' self.selected_game = None # kwdefault(kw, width=self.CHAR_W*64, height=lines*self.CHAR_H) 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.top.wm_minsize(200, 200) self.button = kw.default # self.sc = AllGames_StatsDialogScrolledCanvas( top_frame, width=kw.width, height=kw.height) self.sc.pack(fill='both', expand=True, padx=kw.padx, pady=kw.pady) # self.nodes = {} self.canvas = self.sc.canvas self.canvas.dialog = self bind(self.canvas, "<1>", self.singleClick) self.fillCanvas(player, title) bbox = self.canvas.bbox("all") # print bbox # self.canvas.config(scrollregion=bbox) dx, dy = 4, 0 self.canvas.config(scrollregion=(-dx, -dy, bbox[2]+dx, bbox[3]+dy)) self.canvas.xview_moveto(-dx) self.canvas.yview_moveto(self.YVIEW) # focus = self.createButtons(bottom_frame, kw) self.mainloop(focus, kw.timeout)
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=8, waste=0, texts=1, playcards=20) l.klondikeLayout(**layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = Dumfries_TalonStack(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: s.foundations.append(SS_FoundationStack(r.x, r.y, self, suit=r.suit)) for r in l.s.rows: s.rows.append(Dumfries_RowStack(r.x, r.y, self, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS)) # default l.defaultAll() self.sg.dropstacks.append(s.talon)
def __init__(self, parent, hbar=True, vbar=True, propagate=0, **kw): kwdefault(kw, highlightthickness=0, bd=1, relief='sunken') self.parent = parent self.createFrame(kw) self.canvas = None self.hbar = None self.vbar = None self.hbar_show = False self.vbar_show = False self.createCanvas(kw) self.frame.grid_rowconfigure(0, weight=1) self.frame.grid_columnconfigure(0, weight=1) self.frame.grid_propagate(propagate) if hbar: self.createHbar() self.bindHbar() if vbar: self.createVbar() self.bindVbar()
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=8, reserves=4, texts=0) self.Layout_Method(l, **layout) # self.__class__.__dict__['Layout_Method'](l, **layout) # self.__class__.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: s.foundations.append( self.Foundation_Class(r.x, r.y, self, suit=r.suit)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) for r in l.s.reserves: s.reserves.append(self.ReserveStack_Class(r.x, r.y, self)) # default l.defaultAll()
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=10, waste=0, texts=1, playcards=23) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) if l.s.waste: s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) for i in range(4): r = l.s.foundations[i] s.foundations.append(AC_FoundationStack(r.x, r.y, self, suit=i, max_move=0)) for i in range(4): r = l.s.foundations[i+4] s.foundations.append(Spider_AC_Foundation(r.x, r.y, self)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) # default l.defaultAll() return l
def createGame(self, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=7, reserves=4) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = InitialDealTalonStack(l.s.talon.x, l.s.talon.y, self) for r in l.s.foundations: s.foundations.append(Spider_SS_Foundation(r.x, r.y, self, suit=ANY_SUIT)) for r in l.s.rows: s.rows.append(Scorpion_RowStack(r.x, r.y, self, base_rank=KING)) for r in l.s.reserves: s.reserves.append(ReserveStack(r.x, r.y, self)) # default l.defaultAll()
def createGame(self, **layout): # Create layout l, s = Layout(self), self.s kwdefault(layout, rows=18, playcards=19) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create foundations for r in l.s.foundations: n = 14 + 8 * (r.suit == 4) s.foundations.append(self.Foundation_Class(r.x, r.y, self, r.suit, mod=n, max_cards=n)) # Create rows for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) # Create talon s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) # Define stack groups l.defaultAll()
def createGame(self, max_rounds=-1, num_deal=1, **layout): l, s = Layout(self), self.s kwdefault(layout, rows=8, waste=1) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # Create talon s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) # Create foundations for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit, base_rank=3)) # Create row stacks for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self, base_rank = 0, yoffset=l.YOFFSET)) # Define stack groups l.defaultAll()
def createGame(self, max_rounds=-1, num_deal=1, **layout): # create layout l, s = Layout(self), self.s kwdefault(layout, rows=9, waste=1, texts=1, playcards=19) self.Layout_Method(l, **layout) self.setSize(l.size[0], l.size[1]) # create stacks s.talon = WasteTalonStack(l.s.talon.x, l.s.talon.y, self, max_rounds=max_rounds, num_deal=num_deal) s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) for r in l.s.foundations: s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit)) for r in l.s.rows: s.rows.append(self.RowStack_Class(r.x, r.y, self)) # default l.defaultAll() # extra if max_rounds > 1: anchor = 'nn' if layout.get("texts"): anchor = 'nnn' l.createRoundText(s.talon, anchor) return l
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, base_suit=0, mod=12, max_cards=120, max_move=0) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, mod=12, dir=0, base_suit=ANY_SUIT, max_move=0) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, yoffset, **cap): kwdefault(cap, dir=-1, max_move=1, max_cards=4, max_accept=1, base_rank=3) OpenStack.__init__(self, x, y, game, **cap) self.CARD_YOFFSET = yoffset
def __init__(self, x, y, game, **cap): kwdefault(cap, mod=13, max_move=1) AC_RowStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, mod=13, min_cards=1, max_move=0) SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, max_cards=12, max_move=0, base_rank=ANY_RANK, base_suit=ANY_SUIT) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, max_cards=48, max_move=1, min_accept=1, max_accept=1) Flower_FoundationStack.__init__(self, x, y, game, suit, **cap) self.CARD_YOFFSET = self.game.app.images.CARDH // 20
def __init__(self, x, y, game, **cap): kwdefault(cap, max_move=1, max_accept=0) BasicRowStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, **cap): kwdefault(cap, base_suit=ANY_SUIT) SS_FoundationStack.__init__(self, x, y, game, ANY_SUIT, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, base_rank=suit, mod=13, dir=suit + 1, max_move=0) SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, **cap): kwdefault(cap, max_cards=1, max_accept=1, base_rank=ANY_RANK) OpenStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, **cap): kwdefault(cap, max_move=1, max_accept=1, max_cards=2, base_rank=NO_RANK) OpenStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, **cap): kwdefault(cap, max_move=0, max_accept=1) WasteStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, mod=12, dir=0, base_rank=NO_RANK, max_move=0) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, yoffset=-1, **cap): kwdefault(cap, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS) OpenStack.__init__(self, x, y, game, **cap) if yoffset < 0: yoffset = game.app.images.CARD_YOFFSET self.CARD_YOFFSET = yoffset
def __init__(self, x, y, game, suit, **cap): kwdefault(cap, max_move=0, max_cards=48, max_accept=4, min_accept=4) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap) self.CARD_YOFFSET = self.game.app.images.CARDH // 10
def __init__(self, x, y, game, suit=ANY_SUIT, **cap): kwdefault(cap, max_move=0, max_accept=0, max_cards=game.NCARDS) AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
def __init__(self, x, y, game, suit=ANY_SUIT, **cap): kwdefault(cap, max_move=0, max_accept=0, max_cards=game.NCARDS) OpenStack.__init__(self, x, y, game, **cap)
def __init__(self, x, y, game, yoffset, **cap): kwdefault(cap, max_move=99, max_cards=99, max_accept=99, base_rank=0, dir=1) OpenStack.__init__(self, x, y, game, **cap) self.CARD_YOFFSET = yoffset