wolfhece.textpillow =================== .. py:module:: wolfhece.textpillow .. autoapi-nested-parse:: Author: HECE - University of Liege, Pierre Archambeau Date: 2024 Copyright (c) 2024 University of Liege. All rights reserved. This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited. Module Contents --------------- .. py:class:: Font_Priority(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.textpillow.Font_Priority :parts: 1 :private-bases: Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access:: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: WIDTH :value: 1 .. py:attribute:: HEIGHT :value: 2 .. py:attribute:: FONTSIZE :value: 3 .. py:class:: Relative_Position(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.textpillow.Relative_Position :parts: 1 :private-bases: Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access:: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: TOP_LEFT :value: 1 .. py:attribute:: TOP :value: 4 .. py:attribute:: TOP_RIGHT :value: 7 .. py:attribute:: LEFT :value: 2 .. py:attribute:: CENTER :value: 5 .. py:attribute:: RIGHT :value: 8 .. py:attribute:: BOTTOM_LEFT :value: 3 .. py:attribute:: BOTTOM :value: 6 .. py:attribute:: BOTTOM_RIGHT :value: 9 .. py:function:: load_font(fontname: str, fontsize: int = 10) .. py:class:: Text_Infos(priority=Font_Priority.WIDTH, orientationbase=(1, 0), fontname='arial.ttf', fontsize=10, colour=(0, 0, 0, 255), dimspix=(100, 100), dimsreal=(0, 0), relative_position=Relative_Position.CENTER) Properties of Text_Image Class .. py:attribute:: lengthpix :value: 100 .. py:attribute:: heightpix :value: 100 .. py:attribute:: lengthreal :value: 0 .. py:attribute:: heightreal :value: 0 .. py:attribute:: scalex :value: 1 .. py:attribute:: scaley :value: 1 .. py:attribute:: orientationbase :value: (1, 0) .. py:attribute:: relative_position .. py:attribute:: priority .. py:attribute:: fontsize :value: 10 .. py:attribute:: colour :value: (0, 0, 0, 255) .. py:method:: setsize_pixels(w, h) .. py:method:: setsize_real(wh=(0, 0), scales=(0, 0)) Evalue la taille en pixel sur base de la taille réelle :param wh (float, float): largeur et hauteur dans le système réel :param scales (tuple, optional): Facteur d'échelle selon x et y. Defaults to (0,0) Le facteur d'échelle est évalué comme le rapport entre la taille en pixel et la taille réelle. Exemple : 0.5 --> 2x plus petit en pixels qu'en réel. .. py:method:: findsize(text: str) Trouve la taille en pixel sur base du texte et de la taille de police en cours :param text: Texte à utiliser :type text: str .. py:method:: adapt_fontsize(text) .. py:method:: findscale(dx, dy, w, h) .. py:method:: setscale(sx=1, sy=1) .. py:method:: getcorners(xcenter, ycenter) .. py:method:: getminmax(xcenter, ycenter) .. py:class:: Text_Image(text: str, proptext: Text_Infos, language='en') .. py:attribute:: text .. py:attribute:: width .. py:attribute:: height .. py:attribute:: fontname .. py:attribute:: color .. py:attribute:: language :value: 'en' .. py:attribute:: _font10 .. py:attribute:: priority .. py:attribute:: _image :type: PIL.Image :value: None .. py:property:: image :type: PIL.Image .. py:method:: create_image() .. py:method:: show_image() .. py:data:: myprop