当我在日期范围选择器中按“应用”时,我想动态更改图表中的日期。日期应该相应地对齐。下面是我的代码有误,请向我提供代码
<script>
$('.daterange').on('apply.daterangepicker', function datepicker_Dates(){
mixedChart.data.labels=[{% for item in labels6 %}
"{{item}}",
{% endfor %}];
mixedChart.update();
}); </script>
答案 0 :(得分:0)
在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()