IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Python Discussion :

tqdm - barre de chargement - écran usb 3.5 pouces


Sujet :

Python

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 27
    Points : 15
    Points
    15
    Par défaut tqdm - barre de chargement - écran usb 3.5 pouces
    Bonjour à tous, je réalise pour mon Raspberry, un programme python pour afficher les infos de mon Raspberry sur un petit écran 3.5 pouces branché en USB.

    J'ai deux petits soucis, pour afficher une barre de chargement sur l'écran avec tqdm:

    le premier c'est que le programme m'affiche une erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Traceback (most recent call last):
      File "/home/pi/Desktop/turing/main.py", line 264, in <module>
        DisplayText(lcd_comm, lancement, 5, 280,
      File "/home/pi/Desktop/turing/main.py", line 136, in DisplayText
        assert len(text) > 0, 'Text must not be empty'
    TypeError: object of type 'NoneType' has no len()
    Et le second, j'aimerais enlever sur tqdm, tout ce qui est derrière la barre de chargement " 42/100 [00:00<00:00, 96738.48it/s]" ou au moins " [00:00<00:00, 96738.48it/s] ".

    J'ai pris un programme déjà existant et j'ai rajouté ce qu'il me fallait. Je sais que c'est pas très scolaire mes rajouts mais bon jusque la barre de chargement ça fonctionnait.

    Si quelqu'un peut m'aider. Je lui serais très reconnaissant.

    Merci
    /home/pi/desktop/turing/main.py

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    #!/usr/bin/env python3
     
    # A simple Python manager for "Turing Smart Screen" 3.5" IPS USB-C display
    # https://github.com/mathoudebine/turing-smart-screen-python
     
    import os
    import signal
    import struct
    from datetime import datetime
    from time import sleep
     
    import serial  # Install pyserial : pip install pyserial
    from PIL import Image, ImageDraw, ImageFont  # Install PIL or Pillow
     
    # Set your COM port e.g. COM3 for Windows, /dev/ttyACM0 for Linux...
    COM_PORT = "/dev/ttyACM0"
    # COM_PORT = "COM5"
     
    DISPLAY_WIDTH = 320
    DISPLAY_HEIGHT = 480
     
    class Command:
        RESET = 101
        CLEAR = 102
        SCREEN_OFF = 108
        SCREEN_ON = 109
        SET_BRIGHTNESS = 110
        DISPLAY_BITMAP = 197
     
    with open('/sys/class/thermal/thermal_zone0/temp', 'r') as ftemp:
        current = int(ftemp.read()) / 1000
    print(current)
     
    import shutil
     
    total, used, free = shutil.disk_usage("/media/USBHDD1/MONNAS/DATA")
     
    print("Total: %d GB" % (total // (2**30)))
    print("Used: %d GB" % (used // (2**30)))
    print("Free: %d GB" % (free // (2**30)))
     
    for partition in ['/media/USBHDD1/MONNAS/DATA']:
     
                import subprocess
                detail_disk = subprocess.getoutput("df -h | grep '%s'" % partition) # recup directe en Go
                print("Espace libre de la partition "+partition+" : "+detail_disk.split()[3])
     
                # Si il reste moins de 5 Go de libre = alerte
                if float(detail_disk.split()[3][:-1].replace(',','.')) > 5: print('ALERTE')
     
    exec(open("frequences.py").read())
     
    import os
    os.uname()
    uname = os.uname()
    print("Kernel: " + uname.release)
     
    def SendReg(ser: serial.Serial, cmd: int, x: int, y: int, ex: int, ey: int):
        byteBuffer = bytearray(6)
        byteBuffer[0] = (x >> 2)
        byteBuffer[1] = (((x & 3) << 6) + (y >> 4))
        byteBuffer[2] = (((y & 15) << 4) + (ex >> 6))
        byteBuffer[3] = (((ex & 63) << 2) + (ey >> 8))
        byteBuffer[4] = (ey & 255)
        byteBuffer[5] = cmd
        ser.write(bytes(byteBuffer))
     
     
    def Reset(ser: serial.Serial):
        SendReg(ser, Command.RESET, 0, 0, 0, 0)
     
     
    def Clear(ser: serial.Serial):
        SendReg(ser, Command.CLEAR, 0, 0, 0, 0)
     
     
    def ScreenOff(ser: serial.Serial):
        SendReg(ser, Command.SCREEN_OFF, 0, 0, 0, 0)
     
     
    def ScreenOn(ser: serial.Serial):
        SendReg(ser, Command.SCREEN_ON, 0, 0, 0, 0)
     
     
    def SetBrightness(ser: serial.Serial, level: int):
        # Level : 0 (brightest) - 255 (darkest)
        assert 255 >= level >= 0, 'Brightness level must be [0-255]'
        SendReg(ser, Command.SET_BRIGHTNESS, level, 0, 0, 0)
     
     
    def DisplayPILImage(ser: serial.Serial, image: Image, x: int, y: int):
        image_height = image.size[1]
        image_width = image.size[0]
     
        assert image_height > 0, 'Image width must be > 0'
        assert image_width > 0, 'Image height must be > 0'
     
        SendReg(ser, Command.DISPLAY_BITMAP, x, y, x + image_width - 1, y + image_height - 1)
     
        pix = image.load()
        line = bytes()
        for h in range(image_height):
            for w in range(image_width):
                R = pix[w, h][0] >> 3
                G = pix[w, h][1] >> 2
                B = pix[w, h][2] >> 3
     
                rgb = (R << 11) | (G << 5) | B
                line += struct.pack('H', rgb)
     
                # Send image data by multiple of DISPLAY_WIDTH bytes
                if len(line) >= DISPLAY_WIDTH * 8:
                    ser.write(line)
                    line = bytes()
     
        # Write last line if needed
        if len(line) > 0:
            ser.write(line)
     
        sleep(0.01)  # Wait 10 ms after picture display
     
    def DisplayBitmap(ser: serial.Serial, bitmap_path: str, x=0, y=0):
        image = Image.open(bitmap_path)
        DisplayPILImage(ser, image, x, y)
     
     
    def DisplayText(ser: serial.Serial, text: str, x=0, y=0,
                    font="roboto/Roboto-Regular.ttf",
                    font_size=20,
                    font_color=(0, 0, 0),
                    background_color=(255, 255, 255),
                    background_image: str = None):
        # Convert text to bitmap using PIL and display it
        # Provide the background image path to display text with transparent background
     
        assert len(text) > 0, 'Text must not be empty'
        assert font_size > 0, "Font size must be > 0"
     
        if background_image is None:
            # A text bitmap is created with max width/height by default : text with solid background
            text_image = Image.new('RGB', (DISPLAY_WIDTH, DISPLAY_HEIGHT), background_color)
        else:
            # The text bitmap is created from provided background image : text with transparent background
            text_image = Image.open(background_image)
     
        # Draw text with specified color & font
        font = ImageFont.truetype("./res/fonts/" + font, font_size)
        d = ImageDraw.Draw(text_image)
        d.text((x, y), text, font=font, fill=font_color)
     
        # Crop text bitmap to keep only the text
        text_width, text_height = d.textsize(text, font=font)
        text_image = text_image.crop(box=(x, y, min(x + text_width, DISPLAY_WIDTH), min(y + text_height, DISPLAY_HEIGHT)))
     
        DisplayPILImage(ser, text_image, x, y)
     
     
    def DisplayProgressBar(ser: serial.Serial, x: int, y: int, width: int, height: int, min_value=0, max_value=100,
                           value=50,
                           bar_color=(0, 0, 0),
                           bar_outline=True,
                           background_color=(255, 255, 255),
                           background_image: str = None):
        # Generate a progress bar and display it
        # Provide the background image path to display progress bar with transparent background
     
        assert x + width <= DISPLAY_WIDTH, 'Progress bar width exceeds display width'
        assert y + height <= DISPLAY_HEIGHT, 'Progress bar height exceeds display height'
        assert min_value <= value <= max_value, 'Progress bar value shall be between min and max'
     
        if background_image is None:
            # A bitmap is created with solid background
            bar_image = Image.new('RGB', (width, height), background_color)
        else:
            # A bitmap is created from provided background image
            bar_image = Image.open(background_image)
     
            # Crop bitmap to keep only the progress bar background
            bar_image = bar_image.crop(box=(x, y, x + width, y + height))
     
        # Draw progress bar
        bar_filled_width = value / (max_value - min_value) * width
        draw = ImageDraw.Draw(bar_image)
        draw.rectangle([0, 0, bar_filled_width-1, height-1], fill=bar_color, outline=bar_color)
     
        if bar_outline:
            # Draw outline
            draw.rectangle([0, 0, width-1, height-1], fill=None, outline=bar_color)
     
        DisplayPILImage(ser, bar_image, x, y)
     
     
    stop = False
     
    if __name__ == "__main__":
     
        def sighandler(signum, frame):
            global stop
            stop = True
     
     
        # Set the signal handlers, to send a complete frame to the LCD before exit
        signal.signal(signal.SIGINT, sighandler)
        signal.signal(signal.SIGTERM, sighandler)
        is_posix = os.name == 'posix'
        if is_posix:
            signal.signal(signal.SIGQUIT, sighandler)
     
        # Do not change COM port settings unless you know what you are doing
        lcd_comm = serial.Serial(COM_PORT, 115200, timeout=1, rtscts=1)
     
        # Clear screen (blank)
        Clear(lcd_comm)
     
        # Set brightness to max value
        SetBrightness(lcd_comm, 0)
     
        # Display sample picture
        DisplayBitmap(lcd_comm, "res/example.png")
     
        # Display sample text
        #DisplayText(lcd_comm, " ", 50, 100)
     
        # Display custom text with solid background
        DisplayText(lcd_comm, "Raspberry Pi 4", 70, 150,
                    font="roboto/Roboto-Italic.ttf",
                    font_size=30,
                    font_color=(0, 0, 255),
                    background_color=(255, 255, 0))
     
        # Display custom text with transparent background
     
     
     
        # Display the current time and some progress bars as fast as possible
        bar_value = 0
        while not stop:
            with open('/sys/class/thermal/thermal_zone0/temp', 'r') as ftemp:
                current = int(ftemp.read()) / 1000
            #print(current)
            DisplayText(lcd_comm, "Température: "f'{current}', 5, 200,
                    font="geforce/GeForce-Bold.ttf",
                    font_size=30,
                    font_color=(255, 255, 255),
                    background_image="res/example.png")
     
            for partition in ['/media/USBHDD1/MONNAS/DATA']:
     
                import subprocess
                detail_disk = subprocess.getoutput("df -h | grep '%s'" % partition) # recup directe en Go
                #print("Espace libre de la partition "+partition+" : "+detail_disk.split()[3])
                DisplayText(lcd_comm, "Free HDD: "+ detail_disk.split()[3], 5, 250,
                        #font="roboto/Roboto-Italic.ttf",
                        #font_size=30,
                        #font_color=(0, 0, 255),
                        #background_color=(255, 255, 0))
                        font="roboto/Roboto-Bold.ttf",
                        font_size=30,
                        font_color=(255, 255, 255),
                        background_image="res/example.png")
                # Si il reste moins de 5 Go de libre = alerte
                if float(detail_disk.split()[3][:-1].replace(',','.')) > 5: print('ALERTE')
            lancement = exec(open("barre.py").read())    
            DisplayText(lcd_comm, lancement, 5, 280,
                        #font="roboto/Roboto-Italic.ttf",
                        #font_size=30,
                        #font_color=(0, 0, 255),
                        #background_color=(255, 255, 0))
                    font="roboto/Roboto-Bold.ttf",
                    font_size=20,
                    font_color=(255, 255, 255),
                    background_image="res/example.png")
        # Display text that overflows
            DisplayText(lcd_comm, "Kernel: "+ uname.release, 5, 300,
                    font="roboto/Roboto-Bold.ttf",
                    font_size=30,
                    font_color=(255, 255, 255),
                    background_image="res/example.png")
            exec(open("frequences.py").read())
            DisplayText(lcd_comm, "Fréquences:{1:.0f}/{2:.0f}MHz".format(values[0], values[1], values[2], values[3]), 5, 350,
                    font="roboto/Roboto-Bold.ttf",
                    font_size=25,
                    font_color=(255, 255, 255),
                    background_image="res/example.png")
            DisplayText(lcd_comm, "Voltage: {3:.2f} V".format(values[0], values[1], values[2], values[3]), 5, 400,
                    font="roboto/Roboto-Bold.ttf",
                    font_size=30,
                    font_color=(255, 255, 255),
                    background_image="res/example.png")
            DisplayText(lcd_comm, str(datetime.now().time()), 5, 2,
                        font="roboto/Roboto-Bold.ttf",
                        font_size=30,
                        font_color=(255, 0, 0),
                        background_image="res/example.png")
     
            DisplayProgressBar(lcd_comm, 10, 40,
                               width=140, height=30,
                               min_value=0, max_value=100, value=bar_value,
                               bar_color=(255, 255, 0), bar_outline=True,
                               background_image="res/example.png")
     
            DisplayProgressBar(lcd_comm, 160, 40,
                               width=140, height=30,
                               min_value=0, max_value=19, value=bar_value % 20,
                               bar_color=(0, 255, 0), bar_outline=False,
                               background_image="res/example.png")
     
            bar_value = (bar_value + 2) % 101
     
        lcd_comm.close()

    barre.py dans un autre fichier:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    from tqdm import tqdm
     
    quotient = used / total
     
    percent = quotient * 100
    arrondi = round(percent)
    print(arrondi)
    for i in tqdm(range(arrondi), total=100):
        ...
    frequences.py
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    #!/usr/bin/python
    # -*- coding: utf-8 -*-
     
    import os
    import csv
    import time
     
    delay = 2
    csv_file = "pi_soc_results.csv"
     
    elapsed = 0
     
    def write_csv(mode, value):
        with open (csv_file, mode) as csv_file_opened:
            writer = csv.writer(csv_file_opened)
            writer.writerow(value)
     
        csv_file_opened.close()
     
    def extract_float_value(text, start, end):
        result = ""
     
        if end == "":
            result = text[text.find(start)+1:len(text)]
        else:
            result = text[text.find(start)+1:text.find(end)]
     
        return float(result)
     
    def get_temp():
     
        temp_r = os.popen("vcgencmd measure_temp").readline()
        temp_f = extract_float_value(temp_r, "=", "'")
     
        return temp_f
     
    def get_clock(part):
     
        clock_core_r = os.popen("vcgencmd measure_clock " + part).readline()
        clock_core_f = extract_float_value(clock_core_r, "=", "")/1000000
     
        return clock_core_f
     
    def get_volt():
     
        volt_r = os.popen("vcgencmd measure_volts core").readline()
        volt_f = extract_float_value(volt_r, "=", "V")
     
        return volt_f
     
    print
    print(" Raspberry Pi SoC values :")
    print(" =========================")
    print
     
    #write_csv("w", ["temp", "core freq", "arm freq", "volt", "sec"])
     
    #while True:
     
    values = [get_temp(), get_clock("core"), get_clock("arm"), get_volt(), elapsed]
     
    print(" {0:.0f}°C - {1:.0f}/{2:.0f} MHz - {3:.2f} V".format(values[0], values[1], values[2], values[3]))
    print("{1:.0f}/{2:.0f} MHz".format(values[0], values[1], values[2], values[3]))
    print("{3:.2f} V".format(values[0], values[1], values[2], values[3]))
    #write_csv("a", values)
    #exec(open("frequences.py").read())       
    #time.sleep(delay)
    #elapsed += delay

  2. #2
    Expert éminent

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 300
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 300
    Points : 6 780
    Points
    6 780
    Par défaut
    Salut,

    C'est ce fichier qu'il aurait fallu montrer: /home/pi/Desktop/turing/main.py

    Pas grave s'il est un peu long.

  3. #3
    Expert confirmé Avatar de papajoker
    Homme Profil pro
    Développeur Web
    Inscrit en
    Septembre 2013
    Messages
    2 101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nièvre (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Septembre 2013
    Messages : 2 101
    Points : 4 446
    Points
    4 446
    Par défaut
    bonjour

    Citation Envoyé par pierrot666 Voir le message
    c'est pas très scolaire
    Ce qui compte, c'est s'approprier le code trouvé Si on ne le comprend pas : on ne l'utilise pas (avant de bien le comprendre)


    Citation Envoyé par pierrot666 Voir le message
    m'affiche une erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Traceback (most recent call last):
      File "/home/pi/Desktop/turing/main.py", line 264, in <module>
        DisplayText(lcd_comm, lancement, 5, 280,
      File "/home/pi/Desktop/turing/main.py", line 136, in DisplayText
        assert len(text) > 0, 'Text must not be empty'
    TypeError: object of type 'NoneType' has no len()
    Il faudrait nous dire ce que tu ne comprends pas dans cette erreur, elle est pourtant claire
    TA fonction DisplayText( variables) plante car tu lui passes une variable en paramètre (normalement une chaine) qui n'est pas définie (ou est égale à "None"). Je suppose que ton but est d'afficher quelque chose et pas "rien", peut-être que "barre.py" plante ? (ligne 212)

    Citation Envoyé par VinsS Voir le message
    C'est ce fichier qu'il aurait fallu montrer: /home/pi/Desktop/turing/main.py
    Le fichier est le block no 3 ... par contre ici, la ligne en erreur est ligne 213


    ---------
    Ligne 212 et autres :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    exec(open(xxxxx).read())
    ? je ne connaissais pas
    $moi= ( !== ) ? : ;

  4. #4
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 27
    Points : 15
    Points
    15
    Par défaut
    Depuis j'ai un peu avancé:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    def lancement():
                    exec(open("barre.py").read())
                str(lancement()), 
            DisplayText(lcd_comm, str(lancement()), 5, 280,
    Mais le retour est None!

  5. #5
    Expert confirmé Avatar de papajoker
    Homme Profil pro
    Développeur Web
    Inscrit en
    Septembre 2013
    Messages
    2 101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nièvre (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Septembre 2013
    Messages : 2 101
    Points : 4 446
    Points
    4 446
    Par défaut
    Citation Envoyé par papajoker Voir le message
    Ligne 212 et autres :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    exec(open(xxxxx).read())
    ? je ne connaissais pas


    Et je ne parles pas de ton nouveau code def lancement() ... tu empires les choses, ce n'est même pas du python ...
    $moi= ( !== ) ? : ;

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 27
    Points : 15
    Points
    15
    Par défaut
    Désolé je ne vois pas l'erreur:

    https://www.delftstack.com/fr/howto/...python-script/

    Ce code est utilisé dans python 3.

  7. #7
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 283
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 283
    Points : 36 770
    Points
    36 770
    Par défaut
    Salut,

    Citation Envoyé par pierrot666 Voir le message
    Si quelqu'un peut m'aider. Je lui serais très reconnaissant.
    Il faut comprendre l'erreur, l'instruction assert len(text) > 0, 'Text must not be empty' qui plante avec un 'NoneType' has no len() suggère que la variable text (passée à DisplayText) est assignée à None.
    L'instruction qui appelle DisplayText est ligne 264: DisplayText(lcd_comm, lancement, 5, 280,...
    => c'est lancement qui devient notre text.

    Reste à voir comment a été "fabriqué" cette variable.

    Dans le code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
            lancement = exec(open("barre.py").read())    
            DisplayText(lcd_comm, lancement, 5, 280,
                          ...
    comme exec retourne None... c'est plié.

    Pour corriger, il faut comprendre l'intention initiale... ce qui suppose une lecture attentive de tout ou partie du code (mais déjà utiliser exec fait pleurer...) et pouvoir tester des idées de solutions (comme on n'a pas les équipements...).

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  8. #8
    Expert confirmé Avatar de papajoker
    Homme Profil pro
    Développeur Web
    Inscrit en
    Septembre 2013
    Messages
    2 101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nièvre (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Septembre 2013
    Messages : 2 101
    Points : 4 446
    Points
    4 446
    Par défaut
    prendre des choses au hasard sur le web

    Existe une documentation !
    Vu ton code (def lancement) : tu ne sais pas qu'une fonction retourne (parfois) des choses (ton lancement() ne retourne rien...). Donc a minima lire la doc pour voir si c'est bien ton besoin et voir ce que retourne cette function "exec" magique (pour toi)
    $moi= ( !== ) ? : ;

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 27
    Points : 15
    Points
    15
    Par défaut
    Bonjour, c'est bon j'ai trouvé:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    DisplayProgressBar(lcd_comm, 80, 283,
                        width=140, height=30,
                        min_value=0, max_value=100, value=arrondi,
                        bar_color=(0, 255, 0), bar_outline=True,
                        background_image="res/example.png")
    Merci à vous.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. écran ou barre de chargement
    Par progamer54 dans le forum JSF
    Réponses: 1
    Dernier message: 06/06/2007, 13h58
  2. [Upload] Barre de chargement pour envoi de fichier
    Par Caerbannog dans le forum Langage
    Réponses: 3
    Dernier message: 08/11/2005, 12h27
  3. recherche bidouille pour "barre de chargement"
    Par SpaceFrog dans le forum Général JavaScript
    Réponses: 17
    Dernier message: 27/10/2005, 14h46
  4. [FLASH MX2004] Barre de chargement
    Par stanley dans le forum Flash
    Réponses: 1
    Dernier message: 17/10/2005, 08h35
  5. Réponses: 6
    Dernier message: 05/05/2005, 23h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo