@@ -1183,31 +1183,26 @@ def start_(self):
1183
1183
_log .info ("Camera started" )
1184
1184
self .started = True
1185
1185
1186
- def start (self , config = None , show_preview = False ) -> None :
1186
+ def start (self , config = None , show_preview = None ) -> None :
1187
1187
"""
1188
1188
Start the camera system running.
1189
1189
1190
1190
Camera controls may be sent to the camera before it starts running.
1191
1191
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.
1193
1194
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.
1202
1199
"""
1203
1200
if not self .camera_config and config is None :
1204
1201
config = "preview"
1205
1202
if config is not None :
1206
1203
self .configure (config )
1207
- if not self .camera_config :
1208
- raise RuntimeError ("Camera has not been configured" )
1209
1204
# 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 :
1211
1206
self .start_preview (show_preview )
1212
1207
self .start_ ()
1213
1208
@@ -2394,7 +2389,7 @@ def set_overlay(self, overlay) -> None:
2394
2389
def start_and_capture_files (self , name = "image{:03d}.jpg" ,
2395
2390
initial_delay = 1 , preview_mode = "preview" ,
2396
2391
capture_mode = "still" , num_files = 1 , delay = 1 ,
2397
- show_preview = True , exif_data = None ) -> None :
2392
+ show_preview = None , exif_data = None ) -> None :
2398
2393
"""This function makes capturing multiple images more convenient.
2399
2394
2400
2395
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",
2417
2412
2418
2413
delay - the time delay for every capture after the first (default 1s).
2419
2414
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
2421
2416
displays an image by default during the preview phase, so if captures are back-to-back
2422
2417
with delay zero, then there may be no images shown. This parameter only has any
2423
2418
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",
2453
2448
self .stop ()
2454
2449
2455
2450
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 :
2457
2452
"""This function makes capturing a single image more convenient.
2458
2453
2459
2454
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
2471
2466
capture_mode - the camera mode to use to capture the still images (defaulting to the
2472
2467
Picamera2 object's still_configuration field).
2473
2468
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
2475
2470
displays an image by default during the preview phase. This parameter only has any
2476
2471
effect if a preview is not already running. If it is, it would have to be stopped first
2477
2472
(with the stop_preview method).
@@ -2485,7 +2480,7 @@ def start_and_capture_file(self, name="image.jpg", delay=1, preview_mode="previe
2485
2480
exif_data = exif_data )
2486
2481
2487
2482
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 :
2489
2484
"""This function makes video recording more convenient.
2490
2485
2491
2486
Should only be used in command line applications (not from a Qt application, for example).
0 commit comments