Reputation: 7179
Currently I'm writing a GUI program with Gtk3 in Python. I'm placing a Gtk Calendar in my window but my problem is, that the calendar does not fill the whole area.
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.calendar = Gtk.Calendar()
self.add(self.calendar)
if __name__ == "__main__":
win = MainWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
If I resize my window I would like to expend the height of the calendar rows so they fill the whole window. The columns resize perfectly but the rows doesn't. Can I change this behavior via CSS or do I have to create a subclass of Gtk.Calendar
? I also haven't found a method where the cells are drawn (like paintCell
in Qt) so this is maybe also a bit tricky.
Upvotes: 0
Views: 371
Reputation: 3753
This shows how to increase the row height. Sadly, there does not seem to be a row_expand() so to speak. I guess you could always get the height of the window when it is resizing and do some math to calculate the height of the rows...
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.calendar = Gtk.Calendar()
self.calendar.set_detail_height_rows( 2)
self.calendar.set_property("show-details",True)
self.calendar.set_detail_func(self.detail)
self.add(self.calendar)
def detail (self, calendar, year, month, date):
print calendar, year, month, date
if year == 2017 and date == 24:
return "SO, thumbs up!"
if __name__ == "__main__":
win = MainWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
I got this info from https://developer.gnome.org/gtk3/stable/GtkCalendar.html
Upvotes: 1