MENU
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Python API Reference - BarcodeReader Parameter and Runtime Settings Basic Methods

Method Description
set_mode_argument Sets the optional argument for a specified mode in Modes parameters.
get_mode_argument Gets the optional argument for a specified mode in Modes parameters.
get_runtime_settings Get current runtime settings.
update_runtime_settings Update runtime settings with a given struct.
reset_runtime_settings Resets all parameters to default values.

set_mode_argument

Sets the optional argument for a specified mode in Modes parameters.

BarcodeReader.set_mode_argument(modes_name, index, argument_name, argument_value)

Parameters

  • [in] modes_name <str> : The mode(s) parameter name to set argument.
  • [in] index <int> : The array index of modes parameter to indicate a specific mode.
  • [in] argument_name <str> : The name of the argument to set.
  • [in] argument_value <str> : The value of the argument to set.

Return value

error <tuple> : error_code = error[0], error_message = error[1], if error_code != EnumErrorCode.DBR_OK, you can get the detailed error message by error_message.

Remark

Check follow link for available modes and arguments:

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.binarization_modes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK

try:
    reader.update_runtime_settings(settings)
    error = reader.set_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1")
    if error[0] != 0:
        print(error[1])
except BarcodeReaderError as e:
    print(e)

get_mode_argument

Get argument value for the specified mode parameter.

BarcodeReader.get_mode_argument(modes_name, index, argument_name)

Parameters

  • [in] modes_name <str> : The mode(s) parameter name to get argument.
  • [in] index <int> : The array index of modes parameter to indicate a specific mode.
  • [in] argument_name <str> : The name of the argument to get.

Return value

argument_value <str> : The value of the argument to get.

Exception

BarcodeReaderError : If error happens, this function will throw a BarcodeReaderError exception that can report the detailed error message.

Remark

Check follow link for available modes and arguments:

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.binarization_modes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK
try:
    reader.update_runtime_settings(settings)
    error = reader.set_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1")

    value = reader.get_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy")
    print(value)
except BarcodeReaderError as e:
    print(e)

get_runtime_settings

Gets current settings and save it into a PublicRuntimeSetting object.

BarcodeReader.get_runtime_settings()

Return value

runtime_settings <class PublicRuntimeSetting> : The PublicRuntimeSetting object of current runtime settings.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
print(settings.barcode_format_ids)
print(settings.excepted_barcodes_count)

update_runtime_settings

Update runtime settings with a given PublicRuntimeSetting object.

BarcodeReader.update_runtime_settings(settings)

Parameters

[in] settings <class PublicRuntimeSetting> : a PublicRuntimeSetting object.

Exception

BarcodeReaderError : If error happens, this function will throw a BarcodeReaderError exception that can report the detailed error message.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.barcode_format_ids = EnumBarcodeFormat.BF_ONED
settings.excepted_barcodes_count = 4
try:
    reader.update_runtime_settings(settings)
    changed_settings = reader.get_runtime_settings()
    print(changed_settings.barcode_format_ids)
    print(changed_settings.excepted_barcodes_count)
except BarcodeReaderError as e:
    print(e)

reset_runtime_settings

Reset all parameters to default values.

BarcodeReader.reset_runtime_settings() 

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.barcode_format_ids = EnumBarcodeFormat.BF_ONED
settings.excepted_barcodes_count = 4
try:
    reader.update_runtime_settings(settings)
    changed_settings = reader.get_runtime_settings()
    print(changed_settings.barcode_format_ids)
    print(changed_settings.excepted_barcodes_count)

    reader.reset_runtime_settings()
    reset_settings = reader.get_runtime_settings()
    print(reset_settings.barcode_format_ids)
    print(reset_settings.excepted_barcodes_count)
except BarcodeReaderError as e:
    print(e)

This page is compatible for:

Version 7.5

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest Version
  • version 7.6
  • version 7.5
Change +
© 2003–2020 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support