PyQt5 QCalendarWidget – Getting Context Menu Policy of it
In this article we will see how we can get the context menu policy of the QCalendarWidget. Context menu policy tells how the calendar will show the context menu, there are many policies available for the calendar like NoContextMenu, PreventContextMenu etc. By default calendar has DefaultContextMenu as context policy although we can change this with the help of setContextMenuPolicy method.
In order to do this we will use contextMenuPolicy method with the QCalendarWidget object.
Syntax : calendar.contextMenuPolicy()
Argument : It takes no argument
Return : It return Content Menu Policy object but when printed it shows the associated value of policy.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Below is the implementation