@@ -1183,31 +1183,26 @@ def start_(self):
11831183 _log .info ("Camera started" )
11841184 self .started = True
11851185
1186- def start (self , config = None , show_preview = False ) -> None :
1186+ def start (self , config = None , show_preview = None ) -> None :
11871187 """
11881188 Start the camera system running.
11891189
11901190 Camera controls may be sent to the camera before it starts running.
11911191
1192- The following parameters may be supplied:
1192+ config - if given it is used to configure the camera.
1193+ Defaults to 'preview' configuration if the camera is unconfigured.
11931194
1194- config - if not None this is used to configure the camera. This is just a
1195- convenience so that you don't have to call configure explicitly.
1196-
1197- show_preview - whether to show a preview window. You can pass in the preview
1198- type or True to attempt to autodetect. If left as False you'll get no
1199- visible preview window but the "NULL preview" will still be run. The
1200- value None would mean no event loop runs at all and you would have to
1201- implement your own.
1195+ show_preview - whether to show a preview window. By default no visible preview window
1196+ will be shown but the NullPreview would still run. True will attempt to autodetect.
1197+ False would skip starting an event loop altogether. A Preview enum could also given.
1198+ Note: if an event loop is already running, this has no effect.
12021199 """
12031200 if not self .camera_config and config is None :
12041201 config = "preview"
12051202 if config is not None :
12061203 self .configure (config )
1207- if not self .camera_config :
1208- raise RuntimeError ("Camera has not been configured" )
12091204 # By default we will create an event loop if there isn't one running already.
1210- if show_preview is not None and not self ._event_loop_running :
1205+ if show_preview is not False and not self ._event_loop_running :
12111206 self .start_preview (show_preview )
12121207 self .start_ ()
12131208
@@ -2394,7 +2389,7 @@ def set_overlay(self, overlay) -> None:
23942389 def start_and_capture_files (self , name = "image{:03d}.jpg" ,
23952390 initial_delay = 1 , preview_mode = "preview" ,
23962391 capture_mode = "still" , num_files = 1 , delay = 1 ,
2397- show_preview = True , exif_data = None ) -> None :
2392+ show_preview = None , exif_data = None ) -> None :
23982393 """This function makes capturing multiple images more convenient.
23992394
24002395 Should only be used in command line line applications (not from a Qt application, for example).
@@ -2417,7 +2412,7 @@ def start_and_capture_files(self, name="image{:03d}.jpg",
24172412
24182413 delay - the time delay for every capture after the first (default 1s).
24192414
2420- show_preview - whether to show a preview window (default: yes ). The preview window only
2415+ show_preview - whether to show a preview window (default: no ). The preview window only
24212416 displays an image by default during the preview phase, so if captures are back-to-back
24222417 with delay zero, then there may be no images shown. This parameter only has any
24232418 effect if a preview is not already running. If it is, it would have to be stopped first
@@ -2453,7 +2448,7 @@ def start_and_capture_files(self, name="image{:03d}.jpg",
24532448 self .stop ()
24542449
24552450 def start_and_capture_file (self , name = "image.jpg" , delay = 1 , preview_mode = "preview" ,
2456- capture_mode = "still" , show_preview = True , exif_data = None ) -> None :
2451+ capture_mode = "still" , show_preview = None , exif_data = None ) -> None :
24572452 """This function makes capturing a single image more convenient.
24582453
24592454 Should only be used in command line line applications (not from a Qt application, for example).
@@ -2471,7 +2466,7 @@ def start_and_capture_file(self, name="image.jpg", delay=1, preview_mode="previe
24712466 capture_mode - the camera mode to use to capture the still images (defaulting to the
24722467 Picamera2 object's still_configuration field).
24732468
2474- show_preview - whether to show a preview window (default: yes ). The preview window only
2469+ show_preview - whether to show a preview window (default: no ). The preview window only
24752470 displays an image by default during the preview phase. This parameter only has any
24762471 effect if a preview is not already running. If it is, it would have to be stopped first
24772472 (with the stop_preview method).
@@ -2485,7 +2480,7 @@ def start_and_capture_file(self, name="image.jpg", delay=1, preview_mode="previe
24852480 exif_data = exif_data )
24862481
24872482 def start_and_record_video (self , output , encoder = None , config = None , quality = Quality .MEDIUM ,
2488- show_preview = False , duration = 0 , audio = False ) -> None :
2483+ show_preview = None , duration = 0 , audio = False ) -> None :
24892484 """This function makes video recording more convenient.
24902485
24912486 Should only be used in command line applications (not from a Qt application, for example).
0 commit comments