-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
76,307 additions
and
1,126 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Quickstart | ||
================================================== | ||
|
||
To setup you taktk project there are two modes of uses: | ||
|
||
- :ref:`as-a-library` | ||
- :ref:`as-a-framework` | ||
|
||
|
||
As a library | ||
-------------------------------------------------- | ||
|
||
Taktk supports using it's different components separately. | ||
|
||
.. code-block:: python | ||
from tkinter import Tk | ||
from taktk.component import component | ||
@component | ||
def Widget(self): | ||
r""" | ||
\frame | ||
\label text="Hello world" font={text_font} pos:pack | ||
""" | ||
text_font = "Arial 20" | ||
return locals() | ||
root = Tk() | ||
Widget().render(root).pack() | ||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
sphinxawesome_theme | ||
sphinx-docsearch | ||
git+https://github.com/ken-morel/taktk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import tkinter | ||
from tkinter_gl import GLCanvas | ||
import pywavefront | ||
try: | ||
from OpenGL import GL | ||
except ImportError: | ||
raise ImportError( | ||
""" | ||
This example requires PyOpenGL. | ||
You can install it with "pip install PyOpenGL". | ||
""") | ||
|
||
""" | ||
Shows a square that can be moved with the cursor keys and whose size | ||
can be controlled by a slider. | ||
Shows how to do "animation", that is repeatedly calling draw using the | ||
elapsed time to compute how far the square has moved. Also tests that | ||
we correctly update the GLCanvas to slider events. | ||
""" | ||
|
||
|
||
class ObjView(GLCanvas): | ||
profile = 'legacy' | ||
|
||
def __init__(self, parent): | ||
super().__init__(parent, width=500, height=500) | ||
|
||
self.size = 0.5 | ||
|
||
# Position of square. | ||
self.x = 0.0 | ||
self.y = 0.0 | ||
self.scene = pywavefront.Wavefront('noseman.obj', collect_faces=True) | ||
|
||
|
||
def draw(self): | ||
self.make_current() | ||
|
||
GL.glViewport(0, 0, self.winfo_width(), self.winfo_height()) | ||
GL.glClearColor(0, 0, 0, 1) | ||
GL.glClear(GL.GL_COLOR_BUFFER_BIT) | ||
GL.glRotatef(5, 1, 1, 1) | ||
|
||
GL.glBegin(GL.GL_TRIANGLES) | ||
for face in self.scene.meshes['Quad_Sphere'].faces: | ||
for vertex in face: | ||
vertex = self.scene.vertices[vertex] | ||
x, y, z = vertex | ||
GL.glVertex3f(z / 5, y / 5, z / 5) | ||
print("showing your model...") | ||
GL.glEnd() | ||
# GL.glTranslate(0, 0, 0.1) | ||
|
||
while True: | ||
err = GL.glGetError() | ||
if err == GL.GL_NO_ERROR: | ||
break | ||
print("Error: ", err) | ||
|
||
self.swap_buffers() | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
|
||
root = tkinter.Tk() | ||
view = ObjView(root) | ||
view.pack() | ||
|
||
|
||
root.columnconfigure(1, weight=1) | ||
|
||
print("Using OpenGL", view.gl_version()) | ||
|
||
def update(): | ||
view.draw() | ||
root.after(1, update) | ||
|
||
root.after(1, update) | ||
root.mainloop() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Tkmap example.""" | ||
from tkmap import model, widget | ||
|
||
canvas = widget.Tkmap() | ||
canvas.pack(fill="both", expand=True) | ||
canvas.open( | ||
model.MapModel.load("openstreetmap"), | ||
zoom=10, | ||
location=(48.645272, 1.841411), | ||
) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Blender 3.3.19 MTL File: 'noseman.blend' | ||
# www.blender.org | ||
|
||
newmtl Material | ||
Ns 250.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Kd 0.800000 0.800000 0.800000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.450000 | ||
d 1.000000 | ||
illum 2 |
Oops, something went wrong.