Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e47ee0

Browse files
Salil VanvariNelleV
authored andcommitted
Examples have been made python3 compliant
1 parent a481143 commit 3e47ee0

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

examples/misc/multiprocess.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Demo of using multiprocessing for generating data in one process and plotting
33
# in another.
44
# Written by Robert Cimrman
5+
from six.moves import input
56

67
from __future__ import print_function
78
import time
@@ -76,10 +77,6 @@ def main():
7677
for ii in range(10):
7778
pl.plot()
7879
time.sleep(0.5)
79-
try:
80-
input = raw_input
81-
except NameError:
82-
pass
8380
input('press Enter...')
8481
pl.plot(finished=True)
8582

examples/pylab_examples/griddata_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
from matplotlib.mlab import griddata
33
import matplotlib.pyplot as plt
44
import numpy as np
5+
from six.moves import input
6+
57
# make up data.
6-
#npts = int(raw_input('enter # of random points to plot:'))
8+
#npts = int(input('enter # of random points to plot:'))
79
seed(0)
810
npts = 200
911
x = uniform(-2, 2, npts)

examples/widgets/lasso_selector_demo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
from matplotlib.path import Path
99

1010

11+
try:
12+
raw_input
13+
except NameError:
14+
# Python 3
15+
raw_input = input
16+
17+
1118
class SelectFromCollection(object):
1219
"""Select indices from a matplotlib collection using `LassoSelector`.
1320

0 commit comments

Comments
 (0)