Python Forum

Full Version: IndexError: index out of range: 0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!
Im getting this error:
Quote:processing.app.SketchException: IndexError: index out of range: 0
at jycessing.mode.run.SketchRunner.convertPythonSketchError(Unknown Source)
at jycessing.mode.run.SketchRunner.lambda$startSketch$3(Unknown Source)
at java.lang.Thread.run(Thread.java:748)

Here's the code:
from Segment import Segment

class SevenSegments:
    margin = 20
    seg = Segment(0, 0, 0, False)
    pos = [[],[],[],[],[],[],[]]
    number = 0,
    def __init__(self, num):
        self.number = num
        self.pos = [[self.seg.w+(2*self.margin), self.margin, 90], 
        [self.pos[0][0] + self.seg.h+self.margin, 2*self.margin+self.seg.w, 0], 
        [self.pos[0][0] + self.seg.h+self.margin, 3*self.margin+self.seg.w+self.seg.h, 0], 
        [self.pos[0][0], self.pos[2][1]+self.margin+self.seg.w, 90], 
        [self.margin, 3*self.margin+self.seg.w+self.seg.h, 0],
        [self.margin, 2*self.margin+self.seg.w, 0],
        [self.seg.w +2*self.margin, self.seg.h+self.seg.w+2*self.margin, 90]]
        
    def update(self):
        for i in self.pos:
            s = Segment(self.pos[i][0], self.pos[i][1], self.pos[i][2], True)
            s.show()
Here's the GitHub repo, if you need it: https://github.com/tomXGames/SevenSegment_Display

Any help is appreciated!
This package only dates back to April 30.
I would contact author for instructions as there's no documentation
is this your GitHub repository?