當前位置: 首頁>>代碼示例>>Python>>正文


Python calendar.SUNDAY屬性代碼示例

本文整理匯總了Python中calendar.SUNDAY屬性的典型用法代碼示例。如果您正苦於以下問題:Python calendar.SUNDAY屬性的具體用法?Python calendar.SUNDAY怎麽用?Python calendar.SUNDAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在calendar的用法示例。


在下文中一共展示了calendar.SUNDAY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: cal_command

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def cal_command(message, month=None, year=None):
    """
    一ヶ月のカレンダーを返す
    """
    today = date.today()
    month = int(month) if month else today.month
    year = int(year) if year else today.year

    cal = calendar.TextCalendar(firstweekday=calendar.SUNDAY)
    try:
        botsend(message, '```{}```'.format(cal.formatmonth(year, month)))
    except IndexError:
        # 數字が範囲外の場合は無視する
        pass 
開發者ID:pyconjp,項目名稱:pyconjpbot,代碼行數:16,代碼來源:misc.py

示例2: test_setfirstweekday

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def test_setfirstweekday(self):
        self.assertRaises(ValueError, calendar.setfirstweekday, 'flabber')
        self.assertRaises(ValueError, calendar.setfirstweekday, -1)
        self.assertRaises(ValueError, calendar.setfirstweekday, 200)
        orig = calendar.firstweekday()
        calendar.setfirstweekday(calendar.SUNDAY)
        self.assertEqual(calendar.firstweekday(), calendar.SUNDAY)
        calendar.setfirstweekday(calendar.MONDAY)
        self.assertEqual(calendar.firstweekday(), calendar.MONDAY)
        calendar.setfirstweekday(orig) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:12,代碼來源:test_calendar.py

示例3: test_calendar_kw

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def test_calendar_kw(self):
        widget = Calendar(self.window, firstweekday=calendar.SUNDAY, year=2016, month=12)
        widget.pack() 
開發者ID:TkinterEP,項目名稱:ttkwidgets,代碼行數:5,代碼來源:test_calendar.py

示例4: test_setfirstweekday

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def test_setfirstweekday(self):
        self.assertRaises(TypeError, calendar.setfirstweekday, 'flabber')
        self.assertRaises(ValueError, calendar.setfirstweekday, -1)
        self.assertRaises(ValueError, calendar.setfirstweekday, 200)
        orig = calendar.firstweekday()
        calendar.setfirstweekday(calendar.SUNDAY)
        self.assertEqual(calendar.firstweekday(), calendar.SUNDAY)
        calendar.setfirstweekday(calendar.MONDAY)
        self.assertEqual(calendar.firstweekday(), calendar.MONDAY)
        calendar.setfirstweekday(orig) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:12,代碼來源:test_calendar.py

示例5: main

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def main():
    root = tk.Tk()
    root.title('Tkinter Calendar')
    ttkcal = TtkCalendar(firstweekday=calendar.SUNDAY)
    ttkcal.pack(expand=True, fill=tk.BOTH)
    root.mainloop() 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Cookbook,代碼行數:8,代碼來源:chapter8_07.py

示例6: __init__

# 需要導入模塊: import calendar [as 別名]
# 或者: from calendar import SUNDAY [as 別名]
def __init__(self, parent, callback: callable = None, **kwargs):
        # remove custom options from kw before initializing ttk.Frame
        fwday = calendar.SUNDAY
        year = kwargs.pop('year', self.datetime.now().year)
        month = kwargs.pop('month', self.datetime.now().month)
        locale = kwargs.pop('locale', None)
        sel_bg = kwargs.pop('selectbackground', '#ecffc4')
        sel_fg = kwargs.pop('selectforeground', '#05640e')

        self._date = self.datetime(year, month, 1)
        self._selection = None  # no date selected
        self.callback = callback

        super().__init__(parent, **kwargs)

        self._cal = _get_calendar(locale, fwday)

        self.__setup_styles()       # creates custom styles
        self.__place_widgets()      # pack/grid used widgets
        self.__config_calendar()    # adjust calendar columns and setup tags
        # configure a _canvas, and proper bindings, for selecting dates
        self.__setup_selection(sel_bg, sel_fg)

        # store items ids, used for insertion later
        self._items = [
            self._calendar.insert('', 'end', values='') for _ in range(6)
        ]

        # insert dates in the currently empty calendar
        self._build_calendar() 
開發者ID:slightlynybbled,項目名稱:tk_tools,代碼行數:32,代碼來源:groups.py


注:本文中的calendar.SUNDAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。