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


Python calendar.MONDAY属性代码示例

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


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

示例1: __init__

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import MONDAY [as 别名]
def __init__(self, master=None, **kw):
        now = datetime.datetime.now()
        fwday = kw.pop('firstweekday', calendar.MONDAY)
        year = kw.pop('year', now.year)
        month = kw.pop('month', now.month)
        sel_bg = kw.pop('selectbackground', '#ecffc4')
        sel_fg = kw.pop('selectforeground', '#05640e')

        super().__init__(master, **kw)

        self.selected = None
        self.date = datetime.date(year, month, 1)
        self.cal = calendar.TextCalendar(fwday)
        self.font = tkfont.Font(self)
        self.header = self.create_header()
        self.table = self.create_table()
        self.canvas = self.create_canvas(sel_bg, sel_fg)
        self.build_calendar() 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:20,代码来源:chapter8_07.py

示例2: test_setfirstweekday

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import MONDAY [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_setfirstweekday

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import MONDAY [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

示例4: __init__

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import MONDAY [as 别名]
def __init__(self, master=None, **kw):
        """
        Create a Calendar.
        
        :param master: master widget
        :type master: widget
        :param locale: calendar locale (defines the language, date formatting)
        :type locale: str
        :param firstweekday: first day of the week, 0 is monday
        :type firstweekday: int
        :param year: year to display
        :type year: int
        :param month: month to display
        :type month: int
        :param selectbackground: background color of the selected day
        :type selectbackground: str
        :param selectforeground: selectforeground color of the selected day
        :type selectforeground: str
        :param kw: options to be passed on to the :class:`ttk.Frame` initializer
        """
        # remove custom options from kw before initializating ttk.Frame
        fwday = kw.pop('firstweekday', calendar.MONDAY)
        year = kw.pop('year', self.datetime.now().year)
        month = kw.pop('month', self.datetime.now().month)
        locale = kw.pop('locale', None)
        sel_bg = kw.pop('selectbackground', '#ecffc4')
        sel_fg = kw.pop('selectforeground', '#05640e')

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

        ttk.Frame.__init__(self, master, **kw)

        self._cal = get_calendar(locale, fwday)

        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:TkinterEP,项目名称:ttkwidgets,代码行数:48,代码来源:calendarwidget.py


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