def MouseLeftClick(): canvasDocument.Draw() canvasDocument.DrawPixels() filePath = Dialog.SaveFileDialog() if filePath is not None: canvasDocument.Save(filePath)