Skip to content

Instantly share code, notes, and snippets.

from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.resources import resource_find
from kivy.graphics.fbo import Fbo
from kivy.graphics import (
Callback, PushMatrix, PopMatrix, Rotate, Translate, Scale,
Rectangle, Color, Mesh, UpdateNormalMatrix, Canvas )
from kivy.graphics.transformation import Matrix
from kivy.graphics.opengl import ( glEnable, glDisable, GL_DEPTH_TEST )
from kivy.properties import ( StringProperty, ListProperty, ObjectProperty, NumericProperty, BooleanProperty, DictProperty )
@onslauth
onslauth / directory-listing.txt
Created October 19, 2017 08:19
pyobjus osx python3.6.1
$ tree /usr/local/lib/python3.6/site-packages/pyobjus
/usr/local/lib/python3.6/site-packages/pyobjus
├── __init__.py
├── __pycache__
│   ├── __init__.cpython-36.pyc
│   ├── debug.cpython-36.pyc
│   ├── dylib_manager.cpython-36.pyc
│   ├── objc_py_types.cpython-36.pyc
│   ├── protocols.cpython-36.pyc
│   └── test.cpython-36.pyc
@onslauth
onslauth / python interactive
Created October 19, 2017 07:48
Plyer Filechooser
$ python3
Python 3.6.1 (default, Mar 23 2017, 16:49:01)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from plyer import filechooser
>>> filechooser.choose_dir( )
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/plyer/utils.py", line 88, in _ensure_obj
mod = __import__(module, fromlist='.')
File "/usr/local/lib/python3.6/site-packages/plyer/platforms/macosx/filechooser.py", line 8, in <module>
@onslauth
onslauth / README.md
Last active October 18, 2017 13:48
FileChooser display bug

Hi,

Currently a user is experiencing the following issue with software I have written using kivy.

Screenshot 1

Screenshot 2

@onslauth
onslauth / README.md
Last active October 4, 2017 07:51
Kivy Resolution

Hi,

The problem at hand is with regards to a MacBook Pro with a retina display. In the first image, you can see it is nicely sized and looks as intended.

Screenshot 1

However, if I draw the window to a second monitor plugged into the MacBook, which isn't a retina display, the following happens.

MariaDB [universe]> select version( );
+----------------------------------------+
| version( ) |
+----------------------------------------+
| 10.2.7-MariaDB-10.2.7+maria~xenial-log |
+----------------------------------------+
1 row in set (0.00 sec)
MariaDB [universe]>
@onslauth
onslauth / mesh.py
Last active September 9, 2017 16:56
# Draw the North, East, South, West labels
label = CoreLabel( text = "North", font_size = '20sp', bold = True, color = ( 1, 1, 1, 1 ) )
label.refresh( )
texture = label.texture
Mesh( vertices = ( 0, 0, 0, 0, 1, 1, 1, 0, 1,
2, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 0, 0, 1, 1, 1, 1, 0,
0, 2, 0, 0, 1, 1, 1, 0, 0 ),
indices = [ 0, 1, 2, 0, 2, 3 ],
ChangeState( Kd = ( 0.0, 1.0, 0.0 ),
Ka = ( 1.0, 1.0, 0.0 ),
Ks = ( .3, .3, .3 ),
Tr = 1.,
Ns = 1.,
intensity = 0.8 )
Mesh( vertices = self.borehole_vertices.flatten( ),
indices = self.borehole_indices,
fmt = self.vertex_format,
Traceback (most recent call last):
File "main.py", line 29, in <module>
from kivy.garden.resizable_behavior import ResizableBehavior
File "/usr/local/lib/python3.6/site-packages/kivy/garden/__init__.py", line 100, in load_module
return self._load_module(fullname, moddir)
File "/usr/local/lib/python3.6/site-packages/kivy/garden/__init__.py", line 104, in _load_module
('', '', imp.PKG_DIRECTORY))
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 244, in load_module
return load_package(name, filename)
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 216, in load_package
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
rootpath: os.path.expanduser('~') + "/UCPA"
filters: [ "*.scanit" ]
on_submit: root.double_clicked( )