Python PyQt5.QtWidgets.QDateEdit() Examples

The following are 6 code examples of PyQt5.QtWidgets.QDateEdit(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: Frames.py    From photobooth with GNU Affero General Public License v3.0 6 votes vote down vote up
def createForm(self):

        self._date_widget = QtWidgets.QDateEdit(QtCore.QDate.currentDate())
        self._date_widget.setCalendarPopup(True)

        self._time_widget = QtWidgets.QTimeEdit(QtCore.QTime.currentTime())

        layout = QtWidgets.QFormLayout()
        layout.addRow(_('Date:'), self._date_widget)
        layout.addRow(_('Time:'), self._time_widget)

        widget = QtWidgets.QGroupBox()
        widget.setTitle(_('Set system date and time:'))
        widget.setLayout(layout)
        return widget 
Example #2
Source File: invoice_maker_printable.py    From Mastering-GUI-Programming-with-Python with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())
        self.inputs = dict()
        self.inputs['Customer Name'] = qtw.QLineEdit()
        self.inputs['Customer Address'] = qtw.QPlainTextEdit()
        self.inputs['Invoice Date'] = qtw.QDateEdit(
            date=qtc.QDate.currentDate(), calendarPopup=True)
        self.inputs['Days until Due'] = qtw.QSpinBox(
            minimum=0, maximum=60, value=30)
        for label, widget in self.inputs.items():
            self.layout().addRow(label, widget)

        self.line_items = qtw.QTableWidget(
            rowCount=10, columnCount=3)
        self.line_items.setHorizontalHeaderLabels(
            ['Job', 'Rate', 'Hours'])
        self.line_items.horizontalHeader().setSectionResizeMode(
            qtw.QHeaderView.Stretch)
        self.layout().addRow(self.line_items)
        for row in range(self.line_items.rowCount()):
            for col in range(self.line_items.columnCount()):
                if col > 0:
                    w = qtw.QSpinBox(minimum=0, maximum=300)
                    self.line_items.setCellWidget(row, col, w)
        submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
        self.layout().addRow(submit)

        self.on_submit() 
Example #3
Source File: demoCalendar.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(384, 300)
        self.calendarWidget = QtWidgets.QCalendarWidget(Dialog)
        self.calendarWidget.setGeometry(QtCore.QRect(40, 30, 312, 183))
        self.calendarWidget.setObjectName("calendarWidget")
        self.dateEdit = QtWidgets.QDateEdit(Dialog)
        self.dateEdit.setGeometry(QtCore.QRect(120, 250, 110, 22))
        self.dateEdit.setObjectName("dateEdit")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #4
Source File: coffee_list2.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def createEditor(self, parent, option, proxyModelIndex):
        # make sure to explicitly set the parent
        # otherwise it pops up in a top-level window!
        date_inp = qtw.QDateEdit(parent, calendarPopup=True)
        return date_inp 
Example #5
Source File: invoice_maker.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())
        self.inputs = {}
        self.inputs['Customer Name'] = qtw.QLineEdit()
        self.inputs['Customer Address'] = qtw.QPlainTextEdit()
        self.inputs['Invoice Date'] = qtw.QDateEdit(
            date=qtc.QDate.currentDate(), calendarPopup=True)
        self.inputs['Days until Due'] = qtw.QSpinBox(
            minimum=0, maximum=60, value=30)
        for label, widget in self.inputs.items():
            self.layout().addRow(label, widget)

        self.line_items = qtw.QTableWidget(
            rowCount=10, columnCount=3)
        self.line_items.setHorizontalHeaderLabels(
            ['Job', 'Rate', 'Hours'])
        self.line_items.horizontalHeader().setSectionResizeMode(
            qtw.QHeaderView.Stretch)
        self.layout().addRow(self.line_items)
        for row in range(self.line_items.rowCount()):
            for col in range(self.line_items.columnCount()):
                if col > 0:
                    w = qtw.QSpinBox(minimum=0, maximum=300)
                    self.line_items.setCellWidget(row, col, w)
        submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
        self.layout().addRow(submit) 
Example #6
Source File: main.py    From controleEstoque with MIT License 5 votes vote down vote up
def dt_tabela(self, tabela, row, col, data, status):
        item = QtWidgets.QDateEdit()
        # item.setGeometry(QRect(120, 18, 140, 18))
        item.setFixedWidth(90)
        if status == 1:
            item.setReadOnly(True)
        item.setStyleSheet("QDateEdit {\n"
                           "background: #FFF;\n"
                           "border: none;\n"
                           "font-family: \"Arial\";\n"
                           "font-size: 12px;\n"
                           "font-weight: bold;\n"
                           "color: rgb(80,79,79)\n"
                           "}\n"
                           " QDateEdit::drop-down {\n"
                           "     subcontrol-origin: padding;\n"
                           "     subcontrol-position: top right;\n"
                           "     width: 20px;\n"
                           "     border-left-width: 1px;\n"
                           "     border-left-color: darkgray;\n"
                           "     border-left-style: solid; /* just a single line */\n"
                           "     border-top-right-radius: 3px; /* same radius as the QComboBox */\n"
                           "     border-bottom-right-radius: 3px;\n"
                           " }\n"
                           "QDateEdit::down-arrow {\n"
                           "     image: url(" +
                           self.resourcepath('Images/down.png')+");\n"
                           " }\n"
                           "QCalendarWidget QAbstractItemView:enabled \n"
                           "  {\n"
                           "border: none;\n"
                           "      font-size:13px;  \n"
                           "      color: #000;  \n"
                           "      background-color: #F1F1F1;  \n"
                           "      selection-background-color: rgb(64, 64, 64); \n"
                           "      selection-color: rgb(0, 255, 0); \n"
                           "  }\n"
                           "QCalendarWidget QToolButton {\n"
                           "    border: none;\n"
                           "      color: #000\n"
                           "  }\n"
                           "\n"
                           " QCalendarWidget QMenu {\n"
                           "      width: 150px;\n"
                           "      left: 20px;\n"
                           "      color: white;\n"
                           "      font-size: 18px;\n"
                           "      background-color: rgb(100, 100, 100);\n"
                           "  }\n"
                           "QCalendarWidget QWidget#qt_calendar_navigationbar\n"
                           "{ \n"
                           "border: none;\n"
                           "}")
        item.setCalendarPopup(True)
        item.setDate(data)
        tabela.setCellWidget(row, col, item)


    #Retorna cor status para quantidade abaixo do minimo