
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/show_charset_name.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_show_charset_name.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_show_charset_name.py:


============================
Display unicode person names
============================

Very simple app to display unicode person names.

.. GENERATED FROM PYTHON SOURCE LINES 9-51

.. code-block:: Python


    # authors : Guillaume Lemaitre <g.lemaitre58@gmail.com>
    # license : MIT

    from pydicom.valuerep import PersonName

    import tkinter

    print(__doc__)

    default_encoding = "iso8859"

    root = tkinter.Tk()


    person_names = [
        PersonName(
            # DICOM standard 2008-PS3.5 H.3 p98
            b"Yamada^Tarou=\033$B;3ED\033(B^\033$BB@O:"
            b"\033(B=\033$B$d$^$@\033(B^\033$B$?$m$&\033(B",
            [default_encoding, "iso2022_jp"],
        ),
        # DICOM standard 2008-PS3.5 J.3 p 105
        PersonName(
            b"Wang^XiaoDong=\xcd\xf5\x5e\xd0\xa1\xb6\xab=", [default_encoding, "GB18030"]
        ),
        # DICOM standard 2008-PS3.5 J.1 p 104
        PersonName(
            b"Wang^XiaoDong=\xe7\x8e\x8b\x5e\xe5\xb0\x8f\xe6\x9d\xb1=",
            [default_encoding, "UTF-8"],
        ),
        # DICOM standard 2008-PS3.5 I.2 p 101
        PersonName(
            b"Hong^Gildong=\033$)C\373\363^\033$)C\321\316\324\327="
            b"\033$)C\310\253^\033$)C\261\346\265\277",
            [default_encoding, "euc_kr"],
        ),
    ]
    for person_name in person_names:
        label = tkinter.Label(text=person_name)
        label.pack()
    root.mainloop()


.. _sphx_glr_download_auto_examples_show_charset_name.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: show_charset_name.ipynb <show_charset_name.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: show_charset_name.py <show_charset_name.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: show_charset_name.zip <show_charset_name.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
