我应该如何在我的中国应用日期选择器

2024-10-02 02:41:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在日期范围选择器中按“应用”时动态更改图表中的日期。日期应该对齐相应地,如下所示是我的密码错了,请给我密码

<script>
    $('.daterange').on('apply.daterangepicker', function datepicker_Dates(){
     mixedChart.data.labels=[{% for item in labels6 %}
                  "{{item}}",
                {% endfor %}];
                     mixedChart.update();

    }); </script>

enter image description here


Tags: 密码dataon图表script选择器datepicker动态
1条回答
网友
1楼 · 发布于 2024-10-02 02:41:17

在python中,Tk不包括日期选择器小部件。有几个Python日历小部件可以尝试:

http://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py

http://effbot.org/zone/wcklib-calendar.htm

试试这样的方法:

import Tkinter

import ttkcalendar
import tkSimpleDialog

class CalendarDialog(tkSimpleDialog.Dialog):
    """Dialog box that displays a calendar and returns the selected date"""
    def body(self, master):
        self.calendar = ttkcalendar.Calendar(master)
        self.calendar.pack()

    def apply(self):
        self.result = self.calendar.selection

# Demo code:
def main():
    root = Tkinter.Tk()
    root.wm_title("CalendarDialog Demo")

    def onclick():
        cd = CalendarDialog(root)
        print cd.result

    button = Tkinter.Button(root, text="Click me to see a calendar!", command=onclick)
    button.pack()
    root.update()

    root.mainloop()


if __name__ == "__main__":
    main()

相关问题 更多 >

    热门问题