# Dashed Lines library issue in Python mode

**URL:** <https://discourse.processing.org/t/dashed-lines-library-issue-in-python-mode/2199>\
**Category:** Processing.py\
**Created:** [July 30, 2018, 10:10am UTC](https://discourse.processing.org/t/dashed-lines-library-issue-in-python-mode/2199 "2018-07-30T10:10:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [July 30, 2018, 10:10am UTC](https://discourse.processing.org/t/dashed-lines-library-issue-in-python-mode/2199/1 "2018-07-30T10:10:59Z")

</div>

Hi guys,

I ran into an issue when using the [Dashed Lines library](https://github.com/garciadelcastillo/-dashed-lines-for-processing-) in Python mode. Basically I would like to display a rectangle with dashed lines but it seems the library doesn’t work correctly when using Python mode.

In Java:

```auto
import garciadelcastillo.dashedlines.*;
DashedLines dash;

void setup() {
  size(800, 800);
  
  dash = new DashedLines(this);
  dash.pattern(30, 10, 15, 10);
}

void draw() {
  background(255);

  noFill();
  rectMode(CORNERS);
  dash.rect(200, 100, 400, 500);
    
}

```

 ![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/59420a7a06ed4ab7a72c9eda29c2c83f605a2231.png)

in Python

```auto

add_library('dashedlines')

def setup():
    global dash
    size(800, 800, P2D)
    smooth(8)
    
    dash = DashedLines(this)
    dash.pattern(30, 10, 15, 10)
    
def draw():
    background(255)
    
    noFill()
    rectMode(CORNERS)
    dash.rect(200, 100, 400, 500)

```

 ![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/66f63fa0ae028951319635bded6562ab394502d1.png)

Only `ellipse` seems to work ok on both mode.

Do you think there’s a way to overcome this issue ?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 30, 2018, 11:59am UTC](https://discourse.processing.org/t/dashed-lines-library-issue-in-python-mode/2199/2 "2018-07-30T11:59:43Z")

</div>

## Java Mode:

```auto
import garciadelcastillo.dashedlines.DashedLines;
DashedLines dash;

static final String RENDER = JAVA2D; // Works!
//static final String RENDER = FX2D; // Works!
//static final String RENDER = P2D; // Fails!
//static final String RENDER = P3D; // Fails!

void setup() {
  size(512, 480, RENDER);
  noLoop();

  rectMode(CENTER);
  noFill();
  stroke(#0000FF);
  strokeWeight(2.5);

  (dash = new DashedLines(this)).pattern(30, 10, 15, 10);
}

void draw() {
  background(0350);
  dash.rect(width>>1, height>>1, width>>2, height*.75);
}

```

## Python Mode:

```auto
add_library('dashedlines')

RENDER = JAVA2D # Works!
# RENDER = FX2D # Works!
# RENDER = P2D # Fails!
# RENDER = P3D # Fails!

def setup():
    size(512, 480, RENDER)
    noLoop()

    rectMode(CENTER)
    noFill()
    stroke(0xff0000FF)
    strokeWeight(2.5)

    global dash
    dash = DashedLines(this)
    dash.pattern(30, 10, 15, 10)

def draw():
    background(0350)
    dash.rect(width>>1, height>>1, width>>2, height*.75)

```

---

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [July 30, 2018, 12:30pm UTC](https://discourse.processing.org/t/dashed-lines-library-issue-in-python-mode/2199/3 "2018-07-30T12:30:06Z")

</div>

Thank you @GoToLoop !
