Skip to content

Commit fb3dd0b

Browse files
authored
Merge pull request #6 from einarf/package-cleanup
Package cleanup
2 parents 46313af + 7561777 commit fb3dd0b

File tree

4 files changed

+124
-13
lines changed

4 files changed

+124
-13
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# python
2+
*.pyc
3+
__pycache__
4+
/dist
5+
/build
6+
*.egg-info/
7+
8+
# Virtualenv
9+
/env/
10+
/venv/
11+
/.venv/
12+
/.venv2/
13+
/.venv3/
14+
15+
# IDEs
16+
/.idea
17+
/.vscode

README.md

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,86 @@
1+
# pyopengltk
2+
13
Tkinter - OpenGL Frame using ctypes
24

5+
* [pyopengltk on Github](https://github.com/jonwright/pyopengltk)
6+
* [pyopengltk on PyPI](https://pypi.org/project/pyopengltk/)
7+
38
An opengl frame for pyopengl-tkinter based on ctypes (no togl compilation)
49

510
Collected together by Jon Wright, Jan 2018.
611

7-
Based on the work of others
12+
## Basic Example
13+
14+
This example creates a window containing an `OpenGLFrame`
15+
filling the entire window. We configure it to animate
16+
(constantly redraw) clearing the screen using a green color.
17+
A simple framerate counter is included.
18+
The context information is printed to the terminal.
19+
20+
```python
21+
import time
22+
import tkinter
23+
from OpenGL import GL
24+
from pyopengltk import OpenGLFrame
25+
26+
class AppOgl(OpenGLFrame):
27+
28+
def initgl(self):
29+
"""Initalize gl states when the frame is created"""
30+
GL.glViewport(0, 0, self.width, self.height)
31+
GL.glClearColor(0.0, 1.0, 0.0, 0.0)
32+
self.start = time.time()
33+
self.nframes = 0
34+
35+
def redraw(self):
36+
"""Render a single frame"""
37+
GL.glClear(GL.GL_COLOR_BUFFER_BIT)
38+
tm = time.time() - self.start
39+
self.nframes += 1
40+
print("fps",self.nframes / tm, end="\r" )
41+
42+
43+
if __name__ == '__main__':
44+
root = tkinter.Tk()
45+
app = AppOgl(root, width=320, height=200)
46+
app.pack(fill=tkinter.BOTH, expand=tkinter.YES)
47+
app.animate = 1
48+
app.after(100, app.printContext)
49+
app.mainloop()
50+
```
51+
52+
The repository on Github also contains more examples.
53+
54+
## Install
55+
56+
From PyPI:
57+
58+
```
59+
pip install pyopengltk
60+
```
61+
62+
From source:
63+
64+
```
65+
git clone https://github.com/jonwright/pyopengltk
66+
cd pyopengltk
67+
pip install .
68+
```
69+
70+
## Attributions
71+
72+
Based on the work of others.
73+
74+
### C + Tcl/Tk example:
75+
76+
* Project URL : http://github.com/codeplea/opengl-tcltk/ (zlib license)
77+
* Article at : https://codeplea.com/opengl-with-c-and-tcl-tk
878

9-
C + Tcl/Tk example:
10-
http://github.com/codeplea/opengl-tcltk/
11-
(zlib license)
12-
Article at:
13-
https://codeplea.com/opengl-with-c-and-tcl-tk
79+
### Python + Tkinter (no pyopengl) example:
1480

15-
Python + Tkinter (no pyopengl) example:
16-
http://github.com/arcanosam/pytkogl/
17-
(The Code Project Open License)
18-
Article at
19-
http://www.codeproject.com/Articles/1073475/OpenGL-in-Python-with-TKinter
81+
* Project URL : http://github.com/arcanosam/pytkogl/ (The Code Project Open License)
82+
* Article at: http://www.codeproject.com/Articles/1073475/OpenGL-in-Python-with-TKinter
2083

21-
Large regions of code copied from pyopengl/Tk/__init__.py
84+
### pyopengl
2285

86+
* Large regions of code copied from `pyopengl/Tk/__init__.py`.

setup.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[metadata]
2+
license_files =
3+
LICENSE
4+
5+
[bdist_wheel]
6+
# build universal wheels by default
7+
universal=1

setup.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@
77
author ='Jon Wright',
88
author_email = 'jonathan.wright@gmail.com',
99
url = 'http://github.com/jonwright/pyopengltk',
10-
py_modules=['pyopengltk'],
10+
license='MIT',
11+
description="An opengl frame for pyopengl-tkinter based on ctype",
1112
long_description=open('README.md').read(),
13+
long_description_content_type='text/markdown',
14+
py_modules=['pyopengltk'],
15+
install_requires=[
16+
'pyopengl',
17+
],
18+
keywords=['opengl', 'window', 'context', 'tk', 'tkinter'],
19+
classifiers=[
20+
'License :: OSI Approved :: MIT License',
21+
'Environment :: Win32 (MS Windows)',
22+
'Environment :: X11 Applications',
23+
'Intended Audience :: Developers',
24+
'Topic :: Multimedia :: Graphics',
25+
'Topic :: Multimedia :: Graphics :: 3D Rendering',
26+
'Topic :: Scientific/Engineering :: Visualization',
27+
'Topic :: Software Development :: Libraries :: Python Modules',
28+
'Programming Language :: Python :: 2',
29+
'Programming Language :: Python :: 2.7',
30+
'Programming Language :: Python :: 3',
31+
'Programming Language :: Python :: 3.5',
32+
'Programming Language :: Python :: 3.6',
33+
'Programming Language :: Python :: 3.7',
34+
]
1235
)

0 commit comments

Comments
 (0)