I have a wx.DatePickerCtrl with the dropdown popup window that allows the user to pick a date from the calendar. What I would l like to have my program do is process an event when the user has clicked on a day in the dropdown calendar. Unfortunately the only native event for this control is EVT_DATE_CHANGED and that event gets fired every time the user scrolls the month/year while looking for the date of their choice (firing the event many more times than I would like). I can't seem to access the popup window that is created below the datepickerctrl to see if the window is shown or to bind events directly to it. It isn't created as a child of the datepickerctrl. Basically I'm trying to have the user 1.Click the dropdown button, 2.navigate through the popupwindow calendar, 3. Click on a date, have the popupwindow disappear, 4. Process the event
ihatehippies
11
Junior Poster
Recommended Answers
Jump to PostSomething like this?
import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize) #--Panel so it look good on all platforms self.panel = wx.Panel(self) self.datepick = wx.DatePickerCtrl(self.panel,-1, pos=(20,15), style=wx.DP_DROPDOWN|wx.DP_SHOWCENTURY) self.datepick.Bind(wx.EVT_DATE_CHANGED, self.onAction) self.label = wx.StaticText(self.panel,-1,"", pos=(20,50)) def onAction(self, event): '''Process data from picked date''' …
Jump to PostThe wx.calendar.CalendarCtrl() control gives you more flexibility:
# explore the wx.calendar.CalendarCtrl() control # allows for point and click date input import wx import wx.calendar as cal class MyCalendar(wx.Dialog): """create a simple dialog window with a calendar display""" def __init__(self, parent, mytitle): wx.Dialog.__init__(self, parent, wx.ID_ANY, mytitle) # use …
Jump to PostIt might be time for you to abandon wxPython and use the PySide/PyQT GUI toolkit.
QCalendarWidget behaves the way you want to, here is a test code:'''ps_test_QCalendarWidget1.py simple test code for any PySide widget select a day from a calendar image PySide is the official LGPL-licensed …
All 9 Replies
snippsat
661
Master Poster
ihatehippies
11
Junior Poster
HiHe
174
Junior Poster
ihatehippies
11
Junior Poster
HiHe
174
Junior Poster
ihatehippies
11
Junior Poster
Francesco_2
0
Newbie Poster
Rufus_1
14
Newbie Poster
gdtraveller
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.