pyfig 1.0.0__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.
pyfig-1.0.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Per A. Brodtkorb
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pyfig-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyfig
3
+ Version: 1.0.0
4
+ Summary: Windows-only utilities for arranging and managing Matplotlib and Mayavi figure windows.
5
+ Keywords: matplotlib,mayavi,windows,figure,window,gui
6
+ Author-Email: "Per A. Brodtkorb" <per.andreas.brodtkorb@gmail.com>
7
+ License: BSD 3-Clause License
8
+
9
+ Copyright (c) 2026, Per A. Brodtkorb
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this
15
+ list of conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+
21
+ 3. Neither the name of the copyright holder nor the names of its
22
+ contributors may be used to endorse or promote products derived from
23
+ this software without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+
36
+ Classifier: Development Status :: 5 - Production/Stable
37
+ Classifier: Intended Audience :: Science/Research
38
+ Classifier: Intended Audience :: Developers
39
+ Classifier: License :: OSI Approved :: BSD License
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Programming Language :: Python :: 3.13
45
+ Classifier: Programming Language :: Python :: 3.14
46
+ Classifier: Topic :: Scientific/Engineering
47
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
48
+ Classifier: Operating System :: Microsoft :: Windows
49
+ Requires-Python: >=3.10
50
+ Requires-Dist: pywin32; platform_system == "Windows"
51
+ Provides-Extra: plot
52
+ Requires-Dist: matplotlib>=3.8.0; extra == "plot"
53
+ Provides-Extra: wx
54
+ Requires-Dist: wxPython>=4.2; extra == "wx"
55
+ Description-Content-Type: text/markdown
56
+
57
+ # pyfig
58
+
59
+ Interactive figure and window management for Windows.
60
+
61
+ `pyfig` is a Windows-only Python package for interactively arranging and managing figure windows created by Matplotlib, Mayavi/TVTK, and Chaco.
62
+
63
+ It provides simple functions for:
64
+
65
+ - Tiling, stacking, piling, and cascading windows
66
+ - Minimizing, maximizing, restoring, and hiding figures
67
+ - Snapping windows to screen regions
68
+ - Cycling through figures
69
+ - Closing or keeping selected figures
70
+ - Querying figure positions and screen geometry
71
+
72
+ The package uses the Win32 API and works directly with figure windows after they have been created.
73
+
74
+ ---
75
+
76
+ ## Gallery
77
+
78
+ The examples below use Matplotlib figures, but pyfig can also manipulate
79
+ Mayavi/TVTK and Chaco figure windows.
80
+
81
+ ### Tile all open figures
82
+
83
+ Arrange all open figures in a non-overlapping grid:
84
+
85
+ ```python
86
+ from pyfig import fig
87
+
88
+ fig.tile()
89
+ ```
90
+
91
+ ![Tile layout](docs/images/tile.png)
92
+
93
+ ### Stack all open figures with partial overlap
94
+
95
+ Arrange figures with a staircase-style overlap:
96
+
97
+ ```python
98
+ from pyfig import fig
99
+
100
+ fig.stack()
101
+ ```
102
+
103
+ ![Stack layout](docs/images/stack.png)
104
+
105
+
106
+ ### Snap a figure to the right side of the screen
107
+
108
+ Snap figure number four to the right half of the screen.
109
+
110
+ ```python
111
+ fig.snap_right(4)
112
+ ```
113
+
114
+ ![Snap-right layout](docs/images/snap_right.png)
115
+
116
+ ---
117
+
118
+ ## Features
119
+
120
+ The screenshots above demonstrate only a subset of the functionality available in pyfig.
121
+
122
+ ### Window management
123
+
124
+ ```python
125
+ fig.maximize()
126
+ fig.minimize()
127
+ fig.restore()
128
+ fig.hide()
129
+ ```
130
+
131
+ ### Layout management
132
+
133
+ ```python
134
+ fig.tile()
135
+ fig.stack()
136
+ fig.pile()
137
+ fig.cascade()
138
+ ```
139
+
140
+ ### Screen snapping
141
+
142
+ ```python
143
+ fig.snap_left()
144
+ fig.snap_right()
145
+ fig.snap_top()
146
+ fig.snap_bottom()
147
+ ```
148
+
149
+ ### Figure selection
150
+
151
+ ```python
152
+ fig.close(1, 2)
153
+ fig.keep(3)
154
+ ```
155
+
156
+ ### Interactive cycling
157
+
158
+ ```python
159
+ fig.cycle()
160
+ fig.cycle(pairs=2)
161
+ fig.cycle(interval=1.0)
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Requirements
167
+
168
+ - Windows
169
+ - Python 3.10+
170
+ - pywin32
171
+
172
+ ---
173
+
174
+ ## Installation
175
+
176
+ ### Matplotlib support
177
+
178
+ ```bash
179
+ pip install pyfig[plot]
180
+ ```
181
+
182
+ ### Core package
183
+
184
+ ```bash
185
+ pip install pyfig
186
+ ```
187
+
188
+ ### wxPython support
189
+
190
+ ```bash
191
+ pip install pyfig[wx]
192
+ ```
193
+
194
+ ### Everything
195
+
196
+ ```bash
197
+ pip install pyfig[plot,wx]
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Quick Check
203
+
204
+ After installation, verify that pyfig is working:
205
+
206
+ ```python
207
+ import pyfig
208
+
209
+ pyfig.test()
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Quick Start
215
+
216
+ Create some figures:
217
+
218
+ ```python
219
+ import matplotlib.pyplot as plt
220
+
221
+ for i in range(1, 5):
222
+ plt.figure(i)
223
+ ```
224
+
225
+ Arrange them:
226
+
227
+ ```python
228
+ from pyfig import fig
229
+
230
+ fig.tile()
231
+ ```
232
+
233
+ Stack them:
234
+
235
+ ```python
236
+ fig.stack()
237
+ ```
238
+
239
+ Pile them:
240
+
241
+ ```python
242
+ fig.pile()
243
+ ```
244
+
245
+ Maximize a figure:
246
+
247
+ ```python
248
+ fig.maximize(4)
249
+ ```
250
+
251
+ Close all figures:
252
+
253
+ ```python
254
+ fig.close()
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Examples
260
+
261
+ ### Tile all open figures
262
+
263
+ ```python
264
+ import matplotlib.pyplot as plt
265
+ from pyfig import fig
266
+
267
+ for i in range(1, 5):
268
+ plt.figure(i)
269
+
270
+ fig.tile()
271
+ ```
272
+
273
+ ### Keep only selected figures
274
+
275
+ ```python
276
+ fig.keep(1, 3)
277
+ ```
278
+
279
+ ### Snap a figure to the right side of the screen
280
+
281
+ ```python
282
+ fig.snap_right(4)
283
+ ```
284
+
285
+ ### Center all figures
286
+
287
+ ```python
288
+ fig.center()
289
+ ```
290
+
291
+ ### Cycle through open figures
292
+
293
+ ```python
294
+ fig.cycle(interval=1.0)
295
+ ```
296
+
297
+ ### Cycle through figures in pairs
298
+
299
+ ```python
300
+ fig.cycle(pairs=2)
301
+ ```
302
+
303
+ ---
304
+
305
+ ## Public API
306
+
307
+ All functionality is available through the `pyfig.fig` module:
308
+
309
+ ### Window operations
310
+
311
+ ```python
312
+ close()
313
+ hide()
314
+ restore()
315
+ minimize()
316
+ maximize()
317
+ keep()
318
+ cycle()
319
+ ```
320
+
321
+ ### Layout operations
322
+
323
+ ```python
324
+ tile()
325
+ stack()
326
+ pile()
327
+ cascade()
328
+ center()
329
+ set_size()
330
+ ```
331
+
332
+ ### Screen snapping
333
+
334
+ ```python
335
+ snap_left()
336
+ snap_right()
337
+ snap_top()
338
+ snap_bottom()
339
+ ```
340
+
341
+ ### Information functions
342
+
343
+ ```python
344
+ find_all_figure_numbers()
345
+ find_figure_handles()
346
+
347
+ get_window_position_and_size()
348
+ get_screen_position_and_size()
349
+ ```
350
+
351
+ ### Configuration
352
+
353
+ ```python
354
+ set_prefer_wx()
355
+ ```
356
+
357
+ ---
358
+
359
+ ## wxPython Support
360
+
361
+ If wxPython is installed, pyfig can provide a GUI dialog for figure cycling.
362
+
363
+ Enable it by setting the environment variable:
364
+
365
+ ```bash
366
+ set FIG_USE_WX=1
367
+ ```
368
+
369
+ or programmatically:
370
+
371
+ ```python
372
+ from pyfig import fig
373
+
374
+ fig.set_prefer_wx(True)
375
+ ```
376
+
377
+ Without wxPython, pyfig automatically falls back to a console-based interface.
378
+
379
+ ---
380
+
381
+ ## Testing
382
+
383
+ pyfig includes a convenience function for running its test suite.
384
+
385
+ Run all tests:
386
+
387
+ ```python
388
+ import pyfig
389
+
390
+ pyfig.test()
391
+ ```
392
+
393
+ Run with additional pytest options:
394
+
395
+ ```python
396
+ import pyfig
397
+
398
+ pyfig.test("-v")
399
+ ```
400
+
401
+ Show available pytest options:
402
+
403
+ ```python
404
+ import pyfig
405
+
406
+ pyfig.test("--help")
407
+ ```
408
+
409
+ For development, tests may also be executed directly using PDM:
410
+
411
+ ```bash
412
+ pdm run tests
413
+ ```
414
+
415
+ or:
416
+
417
+ ```bash
418
+ pdm all-tests
419
+ ```
420
+
421
+ ---
422
+
423
+ ## License
424
+
425
+ BSD License.
426
+
427
+ See the `LICENSE` file for details.