CreativePython 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {creativepython-0.1.1 → creativepython-0.1.3}/MANIFEST.in +1 -0
  2. {creativepython-0.1.1/src/CreativePython.egg-info → creativepython-0.1.3}/PKG-INFO +18 -13
  3. {creativepython-0.1.1 → creativepython-0.1.3}/README.md +17 -12
  4. {creativepython-0.1.1 → creativepython-0.1.3}/pyproject.toml +1 -1
  5. creativepython-0.1.1/src/CreativePython/scripts/creativePythonSetup.py → creativepython-0.1.3/src/CreativePython/_creativepythonSetup.py +29 -10
  6. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/_soundfont.py +14 -7
  7. creativepython-0.1.3/src/CreativePython/resources/.DS_Store +0 -0
  8. {creativepython-0.1.1 → creativepython-0.1.3/src/CreativePython.egg-info}/PKG-INFO +18 -13
  9. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython.egg-info/SOURCES.txt +6 -2
  10. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython.egg-info/top_level.txt +3 -0
  11. {creativepython-0.1.1 → creativepython-0.1.3}/src/gui.py +81 -67
  12. creativepython-0.1.3/src/iannix.py +455 -0
  13. creativepython-0.1.3/src/markov.py +543 -0
  14. {creativepython-0.1.1 → creativepython-0.1.3}/src/music.py +71 -73
  15. {creativepython-0.1.1 → creativepython-0.1.3}/src/timer.py +7 -6
  16. creativepython-0.1.3/src/zipf.py +224 -0
  17. {creativepython-0.1.1 → creativepython-0.1.3}/LICENSE +0 -0
  18. {creativepython-0.1.1 → creativepython-0.1.3}/setup.cfg +0 -0
  19. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/__init__.py +0 -0
  20. {creativepython-0.1.1/src/CreativePython/resources → creativepython-0.1.3/src/CreativePython/examples}/.DS_Store +0 -0
  21. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/ArvoPart.CantusInMemoriam.py +0 -0
  22. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/ConcretPH_Xenakis.py +0 -0
  23. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/DeepPurple.SmokeOnTheWater.py +0 -0
  24. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/JS_Bach.Canon.TriasHarmonica.BWV1072.py +0 -0
  25. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/JS_Bach.Canon_1.GoldbergGround.BWV1087.py +0 -0
  26. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/Mozart.MusikalischesWurfelspiel.py +0 -0
  27. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/PierreCage.StructuresPourDeuxChances.py +0 -0
  28. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/RGB_Display.py +0 -0
  29. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/TerryRiley.InC.py +0 -0
  30. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/arpeggiator1.py +0 -0
  31. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/arpeggiator2.py +0 -0
  32. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/autumnLeaves.py +0 -0
  33. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/axelF.py +0 -0
  34. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/biosignals.txt +0 -0
  35. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/boids.py +0 -0
  36. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/brownianMelody.py +0 -0
  37. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/changesByTupac.py +0 -0
  38. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/clementine.py +0 -0
  39. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/continuousPitchInstrumentAudio.py +0 -0
  40. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/drumExample.py +0 -0
  41. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/drumMachinePattern1.py +0 -0
  42. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/drumsComeAlive.py +0 -0
  43. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/fibonacci.py +0 -0
  44. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/findPitchOctave.py +0 -0
  45. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/furElise.py +0 -0
  46. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/generativeMusic.py +0 -0
  47. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/goldenTree.py +0 -0
  48. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/guidoWordMusic.py +0 -0
  49. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/harmonicesMundi.py +0 -0
  50. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/harmonicesMundiRevisisted.py +0 -0
  51. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/harmonographLateral.py +0 -0
  52. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/harmonographRotary.py +0 -0
  53. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoBlackDown.png +0 -0
  54. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoOctave.png +0 -0
  55. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoParallel.py +0 -0
  56. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoSimple.py +0 -0
  57. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoWhiteCenterDown.png +0 -0
  58. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoWhiteLeftDown.png +0 -0
  59. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/iPianoWhiteRightDown.png +0 -0
  60. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiIn1.py +0 -0
  61. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiIn2.py +0 -0
  62. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiIn3.py +0 -0
  63. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiOut.a.py +0 -0
  64. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiOut.b.py +0 -0
  65. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiSynthesizer.py +0 -0
  66. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/midiSynthesizer2.py +0 -0
  67. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/moondog-bird_slament.wav +0 -0
  68. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/musicalSphere.py +0 -0
  69. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/note.py +0 -0
  70. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/octoplus.py +0 -0
  71. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/oscIn1.py +0 -0
  72. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/oscIn2.py +0 -0
  73. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/pentatonicMelody.py +0 -0
  74. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/pianoPhase.py +0 -0
  75. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/pianoRollGenerator.py +0 -0
  76. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/playNote.py +0 -0
  77. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/proteinMusic.py +0 -0
  78. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/randomCircles.py +0 -0
  79. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/randomCirclesThroughMidiInput.py +0 -0
  80. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/randomCirclesTimed.py +0 -0
  81. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/retrograde.a.py +0 -0
  82. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/retrograde.b.py +0 -0
  83. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/retrograde.c.py +0 -0
  84. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/rowYourBoat.py +0 -0
  85. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/scaleTutor.py +0 -0
  86. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sierpinskiTriangle.py +0 -0
  87. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/simpleButtonInstrument.py +0 -0
  88. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/simpleCircleInstrument.py +0 -0
  89. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sineMelody.py +0 -0
  90. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sineMelodyPlus.py +0 -0
  91. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sliderControl.py +0 -0
  92. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sonifyBiosignals.py +0 -0
  93. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/sonifyImage.py +0 -0
  94. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/soundscapeLoutrakiSunset.jpg +0 -0
  95. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/stringQuartet.py +0 -0
  96. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/textMusic.py +0 -0
  97. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/theWayItIs.py +0 -0
  98. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/themeAndVariations.py +0 -0
  99. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/throwingDice.py +0 -0
  100. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/windChimes.py +0 -0
  101. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/examples/zipfMetrics.py +0 -0
  102. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/resources/550973__luizguilherme_a__clean-guitarr-riff.mp3 +0 -0
  103. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/resources/chopper.jpg +0 -0
  104. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython/resources/de-brazzas-monkey.jpg +0 -0
  105. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython.egg-info/dependency_links.txt +0 -0
  106. {creativepython-0.1.1 → creativepython-0.1.3}/src/CreativePython.egg-info/requires.txt +0 -0
  107. {creativepython-0.1.1 → creativepython-0.1.3}/src/_RealtimeAudioPlayer.py +0 -0
  108. {creativepython-0.1.1 → creativepython-0.1.3}/src/image.py +0 -0
  109. {creativepython-0.1.1 → creativepython-0.1.3}/src/midi.py +0 -0
  110. {creativepython-0.1.1 → creativepython-0.1.3}/src/osc.py +0 -0
@@ -1,4 +1,5 @@
1
1
  recursive-include src/CreativePython/resources *
2
2
  recursive-include src/CreativePython/examples *
3
+ recursive-include src/CreativePython/scripts *
3
4
  recursive-exclude */.DS_Store
4
5
  recursive-exclude */__pycache__/*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CreativePython
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A Python-based software environment for developing algorithmic art projects.
5
5
  Author-email: "Dr. Bill Manaris" <manaris@cofc.edu>, Taj Ballinger <ballingertj@g.cofc.edu>, Trevor Ritchie <ritchiets@g.cofc.edu>
6
6
  License: MIT License
@@ -53,19 +53,26 @@ CreativePython is a Python-based software environment for learning and developin
53
53
 
54
54
  CreativePython is distributed under the MIT License.
55
55
 
56
- [Homepage](https://jythonmusic.me/)
56
+ - [Homepage](https://jythonmusic.me/)
57
+ - [Download All Examples [ZIP]](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)
57
58
 
58
59
  This package is still under development.
59
60
 
60
61
  # Beginner Installation (IDLE)
61
62
 
62
- Download and install the latest version of [Python](https://www.python.org/downloads/).
63
+ 1. Download and install the latest version of [Python](https://www.python.org/downloads/).
63
64
 
64
- Download the [CreativePython IDLE Install Script](https://www.dropbox.com/scl/fi/utlo75xun8wuukv7b477i/idleInstaller.py?rlkey=1rumkr7y3263ifd4tflj1o9lo&dl=1).
65
+ 2. Download the [CreativePython Setup Script](https://www.dropbox.com/scl/fi/253bvfqsf0ij3rmza88q5/_creativepythonSetup.py?rlkey=iu4y4u8pujltgfx6kbjmodu9m&dl=1).
65
66
 
66
- Open the `.py` script with IDLE, Python's Integrated Development Learning Environment. From the toolbar, select `Run`, then `Run Module`.
67
+ 3. Open `creativePythonSetup.py` with IDLE, Python's Integrated Development Learning Environment.
67
68
 
68
- CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. **IMPORTANT**: type `yes` in the IDLE Shell and hit enter. Without a soundfont, CreativePython can't produce MIDI sounds.
69
+ 4. From the IDLE toolbar, select `Run`, then `Run Module`.
70
+
71
+ 5. CreativePython will check for its requirements on your system, download any missing requirements, and install its libraries.
72
+
73
+ 6. When you see `[CreativePython Setup]: CreativePython installed successfully.`, you're all done! You're ready to start using CreativePython.
74
+
75
+ **NOTE**: You can use the setup script in any Python3 environment - not just IDLE!
69
76
 
70
77
  # Custom Installation
71
78
 
@@ -97,7 +104,7 @@ pip install CreativePython
97
104
 
98
105
  # Using CreativePython
99
106
 
100
- ## import
107
+ ## Importing Libraries
101
108
 
102
109
  CreativePython's core modules are the `music`, `gui`, `image`, `timer`, `osc`, and `midi` libraries. You can import these libraries into your python code using:
103
110
 
@@ -109,9 +116,9 @@ from music import Note, Play, C4, HN
109
116
 
110
117
  Or a similar statement. CreativePython includes a number of useful constants, so we recommend using wildcard imports like `from music import *`.
111
118
 
112
- **NOTE**: When you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
119
+ **NOTE**: The first time you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
113
120
 
114
- ## running CreativePython programs
121
+ ## Running CreativePython programs
115
122
 
116
123
  CreativePython is designed for use in Python's Interactive Mode. To use Interactive Mode, enter a command like:
117
124
 
@@ -133,7 +140,7 @@ note = Note(C4, HN) # create a middle C half note
133
140
  Play.midi(note) # and play it!
134
141
  ```
135
142
 
136
- In a terminal, run the code using:
143
+ In a terminal, run the code in interactive mode:
137
144
 
138
145
  ```
139
146
  python -i playNote.py
@@ -141,6 +148,4 @@ python -i playNote.py
141
148
 
142
149
  If this is the first time you've used CreativePython, it will ask to download a soundfont.
143
150
 
144
- After that, you should hear a single C4 note.
145
-
146
- [[Download All Examples](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)]
151
+ After you do, you should hear a single C4 half-note.
@@ -4,19 +4,26 @@ CreativePython is a Python-based software environment for learning and developin
4
4
 
5
5
  CreativePython is distributed under the MIT License.
6
6
 
7
- [Homepage](https://jythonmusic.me/)
7
+ - [Homepage](https://jythonmusic.me/)
8
+ - [Download All Examples [ZIP]](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)
8
9
 
9
10
  This package is still under development.
10
11
 
11
12
  # Beginner Installation (IDLE)
12
13
 
13
- Download and install the latest version of [Python](https://www.python.org/downloads/).
14
+ 1. Download and install the latest version of [Python](https://www.python.org/downloads/).
14
15
 
15
- Download the [CreativePython IDLE Install Script](https://www.dropbox.com/scl/fi/utlo75xun8wuukv7b477i/idleInstaller.py?rlkey=1rumkr7y3263ifd4tflj1o9lo&dl=1).
16
+ 2. Download the [CreativePython Setup Script](https://www.dropbox.com/scl/fi/253bvfqsf0ij3rmza88q5/_creativepythonSetup.py?rlkey=iu4y4u8pujltgfx6kbjmodu9m&dl=1).
16
17
 
17
- Open the `.py` script with IDLE, Python's Integrated Development Learning Environment. From the toolbar, select `Run`, then `Run Module`.
18
+ 3. Open `creativePythonSetup.py` with IDLE, Python's Integrated Development Learning Environment.
18
19
 
19
- CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. **IMPORTANT**: type `yes` in the IDLE Shell and hit enter. Without a soundfont, CreativePython can't produce MIDI sounds.
20
+ 4. From the IDLE toolbar, select `Run`, then `Run Module`.
21
+
22
+ 5. CreativePython will check for its requirements on your system, download any missing requirements, and install its libraries.
23
+
24
+ 6. When you see `[CreativePython Setup]: CreativePython installed successfully.`, you're all done! You're ready to start using CreativePython.
25
+
26
+ **NOTE**: You can use the setup script in any Python3 environment - not just IDLE!
20
27
 
21
28
  # Custom Installation
22
29
 
@@ -48,7 +55,7 @@ pip install CreativePython
48
55
 
49
56
  # Using CreativePython
50
57
 
51
- ## import
58
+ ## Importing Libraries
52
59
 
53
60
  CreativePython's core modules are the `music`, `gui`, `image`, `timer`, `osc`, and `midi` libraries. You can import these libraries into your python code using:
54
61
 
@@ -60,9 +67,9 @@ from music import Note, Play, C4, HN
60
67
 
61
68
  Or a similar statement. CreativePython includes a number of useful constants, so we recommend using wildcard imports like `from music import *`.
62
69
 
63
- **NOTE**: When you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
70
+ **NOTE**: The first time you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
64
71
 
65
- ## running CreativePython programs
72
+ ## Running CreativePython programs
66
73
 
67
74
  CreativePython is designed for use in Python's Interactive Mode. To use Interactive Mode, enter a command like:
68
75
 
@@ -84,7 +91,7 @@ note = Note(C4, HN) # create a middle C half note
84
91
  Play.midi(note) # and play it!
85
92
  ```
86
93
 
87
- In a terminal, run the code using:
94
+ In a terminal, run the code in interactive mode:
88
95
 
89
96
  ```
90
97
  python -i playNote.py
@@ -92,6 +99,4 @@ python -i playNote.py
92
99
 
93
100
  If this is the first time you've used CreativePython, it will ask to download a soundfont.
94
101
 
95
- After that, you should hear a single C4 note.
96
-
97
- [[Download All Examples](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)]
102
+ After you do, you should hear a single C4 half-note.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "CreativePython"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "A Python-based software environment for developing algorithmic art projects."
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -5,9 +5,10 @@
5
5
  # Linux: None
6
6
 
7
7
  import os, platform, shutil, subprocess
8
- import sys
8
+ import sys, pathlib
9
9
 
10
10
  debug = True
11
+ LOG_PATH = str(pathlib.Path.home() / "Desktop" / "creativepython-install.log")
11
12
 
12
13
  class SetupError(Exception):
13
14
  pass
@@ -15,16 +16,26 @@ class SetupError(Exception):
15
16
  def _print(text):
16
17
  print(f"[CreativePython Setup]: {text}")
17
18
 
18
- def _run(cmd, env=os.environ):
19
- return subprocess.run(
19
+ def _run(cmd, env=os.environ, log=None, check=True, quiet=True):
20
+ if debug: _print(f"Running: {' '.join(cmd)}")
21
+ result = subprocess.run(
20
22
  cmd,
21
- check=True,
23
+ check=False,
22
24
  text=True,
23
- stdout=subprocess.PIPE,
24
- stderr=subprocess.PIPE,
25
+ stdout=subprocess.PIPE if quiet else None,
26
+ stderr=subprocess.PIPE if quiet else None,
25
27
  env=env
26
28
  )
27
29
 
30
+ if log:
31
+ log.write(f"\n$ {' '.join(cmd)}\n")
32
+ if result.stdout: log.write(result.stdout)
33
+ if result.stderr: log.write(f"\n[stderr]\n{result.stderr}")
34
+ if check and result.returncode != 0:
35
+ raise SetupError(f"Command failed: {' '.join(cmd)} (exit {result.returncode})")
36
+
37
+ return result
38
+
28
39
 
29
40
  def _findHomebrew():
30
41
  if debug: _print("Looking for Homebrew...")
@@ -94,13 +105,21 @@ def _installBrewPackage(package, brew=None):
94
105
 
95
106
 
96
107
  def _installCreativePython():
97
- if debug: _print("Installing CreativePython...")
98
- _run([sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools', 'wheel'])
99
- _run([sys.executable, '-m', 'pip', 'install', 'CreativePython'])
108
+ if debug: _print(f"Installing CreativePython... (log: {LOG_PATH})")
109
+
110
+ with open(LOG_PATH, "w", encoding="utf-8", errors="replace") as log:
111
+ # find the python interpreter location
112
+ py = sys.executable
113
+
114
+ _run([py, '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools', 'wheel'], log=log, check=False)
115
+ _run([py, '-m', 'pip', 'install', '--no-cache-dir', 'CreativePython'], log=log, quiet=True)
100
116
 
101
- import music # import music to install soundfont
102
117
  if debug: _print("CreativePython installed successfully.")
103
118
 
119
+ import music # import music to trigger soundfont download
120
+
121
+
122
+
104
123
  if __name__ == "__main__":
105
124
 
106
125
  if platform.system() == "Darwin": # check for MacOS...
@@ -1,7 +1,7 @@
1
1
  from pathlib import Path
2
2
  from platformdirs import user_data_dir
3
3
  from pooch import retrieve
4
- import shutil, sys, os
4
+ import os
5
5
 
6
6
  APP = "CreativePython"
7
7
  ORG = "CofC"
@@ -15,10 +15,6 @@ SF2_SHA256 = "2ae766ab5c5deb6f7fffacd6316ec9f3699998cce821df3163e7b10a78a64066"
15
15
 
16
16
  ##### SOUNDFONTS #####
17
17
 
18
- def _soundfontPath():
19
- """Expose the intended soundfont path as a method."""
20
- return SOUNDFONT_PATH
21
-
22
18
  def _findSoundfont(candidate=None):
23
19
  """
24
20
  Finds a soundfont 'default.sf2' and returns its location.
@@ -45,6 +41,7 @@ def _findSoundfont(candidate=None):
45
41
  c = candidates[i]
46
42
  if c and c.exists():
47
43
  soundfontPath = str(c)
44
+ i = i + 1
48
45
 
49
46
  return soundfontPath
50
47
 
@@ -59,8 +56,18 @@ def _downloadSoundfont(destination=SOUNDFONT_PATH):
59
56
  path = retrieve(
60
57
  url=SF2_URL,
61
58
  known_hash=f"sha256:{SF2_SHA256}",
62
- progressbar=True,
59
+ progressbar=False,
63
60
  fname=destination.name,
64
61
  path=str(destination.parent)
65
62
  )
66
- return path
63
+ return path
64
+
65
+
66
+ def _installSoundfont():
67
+ soundfontPath = _findSoundfont()
68
+ if not soundfontPath:
69
+ print(f"[CREATIVEPYTHON SETUP]: Downloading MIDI Soundfont...")
70
+ _soundfontPath = _downloadSoundfont()
71
+ print(f"[CREATIVEPYTHON SETUP]: Soundfont downloaded to {_soundfontPath}")
72
+
73
+ return _soundfontPath
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CreativePython
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A Python-based software environment for developing algorithmic art projects.
5
5
  Author-email: "Dr. Bill Manaris" <manaris@cofc.edu>, Taj Ballinger <ballingertj@g.cofc.edu>, Trevor Ritchie <ritchiets@g.cofc.edu>
6
6
  License: MIT License
@@ -53,19 +53,26 @@ CreativePython is a Python-based software environment for learning and developin
53
53
 
54
54
  CreativePython is distributed under the MIT License.
55
55
 
56
- [Homepage](https://jythonmusic.me/)
56
+ - [Homepage](https://jythonmusic.me/)
57
+ - [Download All Examples [ZIP]](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)
57
58
 
58
59
  This package is still under development.
59
60
 
60
61
  # Beginner Installation (IDLE)
61
62
 
62
- Download and install the latest version of [Python](https://www.python.org/downloads/).
63
+ 1. Download and install the latest version of [Python](https://www.python.org/downloads/).
63
64
 
64
- Download the [CreativePython IDLE Install Script](https://www.dropbox.com/scl/fi/utlo75xun8wuukv7b477i/idleInstaller.py?rlkey=1rumkr7y3263ifd4tflj1o9lo&dl=1).
65
+ 2. Download the [CreativePython Setup Script](https://www.dropbox.com/scl/fi/253bvfqsf0ij3rmza88q5/_creativepythonSetup.py?rlkey=iu4y4u8pujltgfx6kbjmodu9m&dl=1).
65
66
 
66
- Open the `.py` script with IDLE, Python's Integrated Development Learning Environment. From the toolbar, select `Run`, then `Run Module`.
67
+ 3. Open `creativePythonSetup.py` with IDLE, Python's Integrated Development Learning Environment.
67
68
 
68
- CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. **IMPORTANT**: type `yes` in the IDLE Shell and hit enter. Without a soundfont, CreativePython can't produce MIDI sounds.
69
+ 4. From the IDLE toolbar, select `Run`, then `Run Module`.
70
+
71
+ 5. CreativePython will check for its requirements on your system, download any missing requirements, and install its libraries.
72
+
73
+ 6. When you see `[CreativePython Setup]: CreativePython installed successfully.`, you're all done! You're ready to start using CreativePython.
74
+
75
+ **NOTE**: You can use the setup script in any Python3 environment - not just IDLE!
69
76
 
70
77
  # Custom Installation
71
78
 
@@ -97,7 +104,7 @@ pip install CreativePython
97
104
 
98
105
  # Using CreativePython
99
106
 
100
- ## import
107
+ ## Importing Libraries
101
108
 
102
109
  CreativePython's core modules are the `music`, `gui`, `image`, `timer`, `osc`, and `midi` libraries. You can import these libraries into your python code using:
103
110
 
@@ -109,9 +116,9 @@ from music import Note, Play, C4, HN
109
116
 
110
117
  Or a similar statement. CreativePython includes a number of useful constants, so we recommend using wildcard imports like `from music import *`.
111
118
 
112
- **NOTE**: When you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
119
+ **NOTE**: The first time you import `music`, CreativePython will ask permission to download a high-quality soundfont (FluidR3 G2-2.sf2) for you. You should only have to do this once.
113
120
 
114
- ## running CreativePython programs
121
+ ## Running CreativePython programs
115
122
 
116
123
  CreativePython is designed for use in Python's Interactive Mode. To use Interactive Mode, enter a command like:
117
124
 
@@ -133,7 +140,7 @@ note = Note(C4, HN) # create a middle C half note
133
140
  Play.midi(note) # and play it!
134
141
  ```
135
142
 
136
- In a terminal, run the code using:
143
+ In a terminal, run the code in interactive mode:
137
144
 
138
145
  ```
139
146
  python -i playNote.py
@@ -141,6 +148,4 @@ python -i playNote.py
141
148
 
142
149
  If this is the first time you've used CreativePython, it will ask to download a soundfont.
143
150
 
144
- After that, you should hear a single C4 note.
145
-
146
- [[Download All Examples](https://www.dropbox.com/scl/fo/rvc8m8pt4m0281qn0t4oi/AO2Y0W2qOrOcurlQmLa7M54?rlkey=0sf80bmov135tc85dk9k7ats6&dl=1)]
151
+ After you do, you should hear a single C4 half-note.
@@ -4,18 +4,23 @@ README.md
4
4
  pyproject.toml
5
5
  src/_RealtimeAudioPlayer.py
6
6
  src/gui.py
7
+ src/iannix.py
7
8
  src/image.py
9
+ src/markov.py
8
10
  src/midi.py
9
11
  src/music.py
10
12
  src/osc.py
11
13
  src/timer.py
14
+ src/zipf.py
12
15
  src/CreativePython/__init__.py
16
+ src/CreativePython/_creativepythonSetup.py
13
17
  src/CreativePython/_soundfont.py
14
18
  src/CreativePython.egg-info/PKG-INFO
15
19
  src/CreativePython.egg-info/SOURCES.txt
16
20
  src/CreativePython.egg-info/dependency_links.txt
17
21
  src/CreativePython.egg-info/requires.txt
18
22
  src/CreativePython.egg-info/top_level.txt
23
+ src/CreativePython/examples/.DS_Store
19
24
  src/CreativePython/examples/ArvoPart.CantusInMemoriam.py
20
25
  src/CreativePython/examples/ConcretPH_Xenakis.py
21
26
  src/CreativePython/examples/DeepPurple.SmokeOnTheWater.py
@@ -100,5 +105,4 @@ src/CreativePython/examples/zipfMetrics.py
100
105
  src/CreativePython/resources/.DS_Store
101
106
  src/CreativePython/resources/550973__luizguilherme_a__clean-guitarr-riff.mp3
102
107
  src/CreativePython/resources/chopper.jpg
103
- src/CreativePython/resources/de-brazzas-monkey.jpg
104
- src/CreativePython/scripts/creativePythonSetup.py
108
+ src/CreativePython/resources/de-brazzas-monkey.jpg
@@ -1,8 +1,11 @@
1
1
  CreativePython
2
2
  _RealtimeAudioPlayer
3
3
  gui
4
+ iannix
4
5
  image
6
+ markov
5
7
  midi
6
8
  music
7
9
  osc
8
10
  timer
11
+ zipf
@@ -1480,108 +1480,122 @@ class Display(Interactable):
1480
1480
  self._callbackFunctions['onClose'] = function
1481
1481
 
1482
1482
 
1483
- ### CONVENIENCE METHODS
1484
-
1485
- def drawLine(self, x1, y1, x2, y2):
1486
- """
1487
- Draws a basic line from (x1, y1) to (x2, y2).
1483
+ # drawing functions (for convenience)
1484
+ def drawLine(self, x1, y1, x2, y2, color=Color.BLACK, thickness=1):
1488
1485
  """
1489
- line = Line(x1, y1, x2, y2)
1490
- self.add(line)
1491
- return line
1486
+ Draw a line between the points (x1, y1) and (x2, y2) with given color and thickness.
1492
1487
 
1493
- def drawCircle(self, x, y, radius):
1494
- """
1495
- Draws a basic circle with the specified radius and center coordinates.
1488
+ Returns the line object (in case we want to move it or delete it later).
1496
1489
  """
1497
- circle = Circle(x, y, radius)
1498
- self.add(circle)
1499
- return circle
1490
+ line = Line(x1, y1, x2, y2, color, thickness) # create line
1491
+ self.add(line) # add it
1492
+ return line # and return it
1500
1493
 
1501
-
1502
- def drawPoint(self, x, y):
1503
- """
1504
- Draws a basic point at the specified coordinates.
1494
+ def drawCircle(self, x, y, radius, color = Color.BLACK, fill = False, thickness=1):
1505
1495
  """
1506
- point = Point(x, y)
1507
- self.add(point)
1508
- return point
1509
-
1496
+ Draw a circle at (x, y) with the given radius, color, fill, and thickness.
1510
1497
 
1511
- def drawOval(self, x1, y1, x2, y2):
1498
+ Returns the circle object (in case we want to move it or delete it later).
1512
1499
  """
1513
- Draws a basic oval with the specified bounding box.
1514
- The bounding box is defined by the top-left corner (x1, y1)
1515
- and the bottom-right corner (x2, y2).
1516
- """
1517
- oval = Oval(x1, y1, x2, y2)
1518
- self.add(oval)
1519
- return oval
1520
-
1500
+ circle = Circle(x, y, radius, color, fill, thickness) # create circle
1501
+ self.add(circle) # add it
1502
+ return circle # and return it
1521
1503
 
1522
- def drawRectangle(self, x1, y1, x2, y2):
1504
+ def drawPoint(self, x, y, color = Color.BLACK, thickness=1):
1523
1505
  """
1524
- Draws a basic rectangle with the specified bounding box.
1525
- The bounding box is defined by the top-left corner (x1, y1)
1526
- and the bottom-right corner (x2, y2).
1506
+ Draw a point at (x, y) with the given color and thickness.
1507
+
1508
+ Returns the point object (in case we want to move it or delete it later).
1527
1509
  """
1528
- rectangle = Rectangle(x1, y1, x2, y2)
1529
- self.add(rectangle)
1530
- return rectangle
1510
+ point = Point(x, y, color, thickness) # create point
1511
+ self.add(point) # add it
1512
+ return point # and return it
1531
1513
 
1514
+ def drawOval(self, x1, y1, x2, y2, color = Color.BLACK, fill = False, thickness = 1):
1515
+ """
1516
+ Draw an oval using the coordinates of its enclosing rectangle with the given color,
1517
+ fill, and thickness.
1532
1518
 
1533
- def drawPolyLine(self, xPoints, yPoints):
1519
+ Returns the oval object (in case we want to move it or delete it later).
1534
1520
  """
1535
- Draws a basic polyline with the specified points.
1536
- The points are defined by two lists of x and y coordinates.
1521
+ oval = Oval(x1, y1, x2, y2, color, fill, thickness) # create oval
1522
+ self.add(oval) # add it
1523
+ return oval # and return it
1524
+
1525
+ def drawArc(self, x1, y1, x2, y2, startAngle, endAngle, color = Color.BLACK, fill = False, thickness = 1):
1537
1526
  """
1538
- polyline = PolyLine(xPoints, yPoints)
1539
- self.add(polyline)
1540
- return polyline
1527
+ Draw an arc using the provided coordinates, arc angles, color, fill, and thickness.
1541
1528
 
1529
+ Returns the arc object (in case we want to move it or delete it later).
1530
+ """
1531
+ arc = Arc(x1, y1, x2, y2, startAngle, endAngle, color, fill, thickness) # create arc
1532
+ self.add(arc) # add it
1533
+ return arc # and return it
1542
1534
 
1543
- def drawPolygon(self, xPoints, yPoints):
1535
+ def drawRectangle(self, x1, y1, x2, y2, color = Color.BLACK, fill = False, thickness = 1):
1544
1536
  """
1545
- Draws a basic polygon with the specified points.
1546
- The points are defined by two lists of x and y coordinates.
1537
+ Draw a rectangle using the provided coordinates, color, fill, and thickness.
1538
+
1539
+ Returns the rectangle object (in case we want to move it or delete it later).
1547
1540
  """
1548
- polygon = Polygon(xPoints, yPoints)
1549
- self.add(polygon)
1550
- return polygon
1541
+ rec = Rectangle(x1, y1, x2, y2, color, fill, thickness) # create rectangle
1542
+ self.add(rec) # add it
1543
+ return rec # and return it
1551
1544
 
1545
+ def drawPolygon(self, xPoints, yPoints, color = Color.BLACK, fill = False, thickness = 1):
1546
+ """
1547
+ Draw a polygon using the provided coordinates, color, fill, and thickness.
1552
1548
 
1553
- def drawIcon(self, filename, x=0, y=0):
1549
+ Returns the polygon object (in case we want to move it or delete it later).
1554
1550
  """
1555
- Draws an icon at the specified coordinates.
1551
+ poly = Polygon(xPoints, yPoints, color, fill, thickness) # create polygon
1552
+ self.add(poly) # add it
1553
+ return poly # and return it
1554
+
1555
+ def drawIcon(self, filename, x, y, width = None, height = None):
1556
1556
  """
1557
- icon = Icon(filename)
1558
- icon.setPosition(x, y)
1559
- self.add(icon)
1560
- return icon
1557
+ Draw an icon (image) from the provided external file (.jpg or .png) at the given coordinates (top-left).
1558
+ Also rescale according to provided width and height (if any).
1561
1559
 
1560
+ Returns the icon object (in case we want to move it or delete it later).
1561
+ """
1562
+ icon = Icon(filename, width, height) # load image (and rescale, if specified)
1563
+ self.add(icon, x, y) # add it at given coordinates
1564
+ return icon # and return it
1562
1565
 
1563
- def drawImage(self, filename, x=0, y=0):
1566
+ def drawImage(self, filename, x, y, width = None, height = None):
1564
1567
  """
1565
1568
  Same as drawIcon().
1566
- """
1567
- return self.drawIcon(filename, x, y)
1568
1569
 
1570
+ Returns the image object (in case we want to move it or delete it later).
1571
+ """
1572
+ return self.drawIcon(filename, x, y, width, height)
1569
1573
 
1570
- def drawLabel(self, text, x=0, y=0):
1574
+ def drawLabel(self, text, x, y, color = Color.BLACK, font = None):
1571
1575
  """
1572
- Draws a basic label at the specified coordinates.
1576
+ Draw the text label on the display at the given coordinates (top-left) and with the provided
1577
+ color and font.
1578
+
1579
+ Returns the label object (in case we want to move it or delete it later).
1573
1580
  """
1574
- label = Label(text)
1575
- label.setPosition(x, y)
1576
- self.add(label)
1577
- return label
1578
1581
 
1582
+ # Font example - Font("Serif", Font.ITALIC, 16)
1583
+ #
1584
+ # see http://docs.oracle.com/javase/tutorial/2d/text/fonts.html#logical-fonts
1579
1585
 
1580
- def drawText(self, text, x=0, y=0):
1586
+ label = Label(text, LEFT, color) # create label
1587
+ if font: # did they provide a font?
1588
+ label.setFont(font) # yes, so set it
1589
+ self.add(label, x, y) # add it at given coordinates
1590
+ return label # and return it
1591
+
1592
+ def drawText(self, text, x, y, color = Color.BLACK, font = None):
1581
1593
  """
1582
1594
  Same as drawLabel().
1595
+
1596
+ Returns the label object (in case we want to move it or delete it later).
1583
1597
  """
1584
- return self.drawLabel(text, x, y)
1598
+ return self.drawLabel(text, x, y, color, font)
1585
1599
 
1586
1600
 
1587
1601
  #######################################################################################