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


Python QtCore.QDate方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QDate [as 別名]
def __init__(self, title="Calendar"):
        super(CalendarWidget, self).__init__()

        self.setWindowTitle(title)
        layout = qt_widgets.QGridLayout()
        layout.setColumnStretch(1, 1)

        self.cal = qt_widgets.QCalendarWidget(self)
        self.cal.setGridVisible(True)
        self.cal.clicked[QtCore.QDate].connect(self.show_date)
        layout.addWidget(self.cal, 0, 0, 1, 2)

        self.date_label = qt_widgets.QLabel()
        self.date = self.cal.selectedDate()
        self.date_label.setText(self.date.toString())
        layout.addWidget(self.date_label, 1, 0)

        button_box = qt_widgets.QDialogButtonBox()
        confirm_button = button_box.addButton(qt_widgets.QDialogButtonBox.Ok)
        confirm_button.clicked.connect(self.confirm)
        layout.addWidget(button_box, 1, 1)

        self.setLayout(layout)
        self.show()
        self.raise_() 
開發者ID:aroberge,項目名稱:easygui_qt,代碼行數:27,代碼來源:calendar_widget.py

示例2: initUI

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QDate [as 別名]
def initUI(self):      

        vbox = QVBoxLayout(self)

        cal = QCalendarWidget(self)
        cal.setGridVisible(True)
        cal.clicked[QDate].connect(self.showDate)

        vbox.addWidget(cal)

        self.lbl = QLabel(self)
        date = cal.selectedDate()
        self.lbl.setText(date.toString())

        vbox.addWidget(self.lbl)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('Calendar')
        self.show() 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:23,代碼來源:QCalendarWidget.py

示例3: set_time_limits

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QDate [as 別名]
def set_time_limits(self):
        selected_date = self.calendar_widget.selectedDate()
        if selected_date == QDate(*self.creation_date):
            self.time_edit.setMinimumTime(QTime(*self.creation_time))
        else:
            self.time_edit.clearMinimumTime()
        if selected_date == QDate(*self.now_date):
            self.time_edit.setMaximumTime(QTime(*self.now_time))
        else:
            self.time_edit.clearMaximumTime() 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:12,代碼來源:timestamped_workspace_widget.py

示例4: enable_with_timestamp

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QDate [as 別名]
def enable_with_timestamp(self):
        creation = self.limits_job.ret.in_timezone("local")
        self.limits_job = None
        self.creation_date = (creation.year, creation.month, creation.day)
        self.creation_time = (creation.hour, creation.minute, creation.second)
        now = pendulum.now().in_timezone("local")
        self.now_date = (now.year, now.month, now.day)
        self.now_time = (now.hour, now.minute, now.second)
        self.calendar_widget.setMinimumDate(QDate(*self.creation_date))
        self.calendar_widget.setMaximumDate(QDate(*self.now_date))
        self.calendar_widget.selectionChanged.connect(self.set_time_limits)
        self.set_time_limits()
        self.time_edit.setDisplayFormat("h:mm:ss") 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:15,代碼來源:timestamped_workspace_widget.py

示例5: init_shares_tab_ui

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QDate [as 別名]
def init_shares_tab_ui(self):
        """Shares."""
        self.shares_tab = QtGui.QWidget()
        self.shares_layout = QtGui.QFormLayout(self.shares_tab)
        today = datetime.today()

        self.shares_date_from = QtGui.QDateEdit()
        self.shares_date_from.setMinimumDate(QtCore.QDate(1900, 1, 1))
        self.shares_date_from.setMaximumDate(QtCore.QDate(2030, 12, 31))
        self.shares_date_from.setDate(QtCore.QDate(today.year, 1, 1))
        self.shares_date_from.setDisplayFormat('dd.MM.yyyy')

        self.shares_date_to = QtGui.QDateEdit()
        self.shares_date_to.setMinimumDate(QtCore.QDate(1900, 1, 1))
        self.shares_date_to.setMaximumDate(QtCore.QDate(2030, 12, 31))
        self.shares_date_to.setDate(
            QtCore.QDate(today.year, today.month, today.day)
        )
        self.shares_date_to.setDisplayFormat('dd.MM.yyyy')

        self.shares_symbol_list = QtGui.QComboBox()
        self.shares_symbol_list.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.shares_symbol_list.setMaxVisibleItems(20)
        self.shares_symbol_list.setEditable(True)

        self.shares_show_btn = QtGui.QPushButton('Load')
        self.shares_show_btn.clicked.connect(self.update_data)

        self.shares_layout.addRow('From', self.shares_date_from)
        self.shares_layout.addRow('To', self.shares_date_to)
        self.shares_layout.addRow('Symbol', self.shares_symbol_list)
        self.shares_layout.addRow(None, self.shares_show_btn)

        self.select_source.addTab(self.shares_tab, 'Shares/Futures/ETFs') 
開發者ID:constverum,項目名稱:Quantdom,代碼行數:36,代碼來源:ui.py


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