0

When opening a calendar from a window in PySimpleGUI, the window defaults to the top left of the screen. Setting the window's location changes only the original window, not the popup calendar. Is there a way to change the calendar's location?

import PySimpleGUI as sg

layout = [[sg.Text('Date to Start Summing')],
          [sg.In(key='-CAL-', visible=False),
           sg.CalendarButton('Calendar', target='-CAL-', pad=None, font=('MS Sans Serif', 10, 'bold'),
                             button_color=('red', 'white'), format='%m/%d/%Y')],
          [sg.Text('Filename')],
          [sg.In(key='-DIR-', visible=False),
           sg.Input(size=(20, None)), sg.FileBrowse('Browse', target='-DIR-')],
          [sg.OK(), sg.Cancel()]]


window = sg.Window('Data Collector', layout, grab_anywhere=False, size=(400, 280), return_keyboard_events=True, finalize=True)

event, values = window.read()
Alex Elfont
  • 115
  • 1
  • 12
  • you would have to dig in source code to change it or copy code to create own function which opens window with calendar – furas Mar 05 '20 at 05:20
  • It's not currently supported. If you check the Issues on the project's GitHub I'm sure you'll find an enhancement request already opened for it. Another option is to build your own calendar chooser window. – Mike from PSG Mar 06 '20 at 09:13
  • use location parameter on CalendarButton: location=[x,y] – matan h Nov 02 '20 at 11:35

0 Answers0