omz:software Forums

Pythonista

Search Results

Re: motion.get_attitude returns 0

remember, imported code is only executed once! so unless you use `reload`, that function will not be called again.


Re: Pythonista 1.6 Beta #160020

mostly this is an issue with tabs ... in 1.5 we knew to reload the file in the editor if modifying externally. having ability to programatically check what is in each tab, and reload specific tabs programatically would fix my particular use case.


Re: Pythonista 1.6 Beta #160020

@JonB > 1) NSDictionary get/set using python dictionary language doesnt seem to work. at least for dicts found in the wild It's likely that dictionaries you find "in the wild" are `NSDictionary` instances, not `NSMutableDictionary`, so they're...


Re: Pythonista 1.6 Beta #160020

Few more comments on latest beta. 1) NSDictionary get/set using python dictionary language doesnt seem to work. at least for dicts found in the wild, the isKindClass seems to not be returning true. i wonder if it would be better to look for whether...


Re: Proof of concept HTML Editor

tableview stuff gets set in the delegate. i believe you can call table reload (or refresh?) to apply the new theme to the existing cells. there are ways to access cell properties through callbacks, but otherwise iirc there is not an easy way to find...


Re: Virtual display container

I have tried again with this code. I have attempted to update the buffering system. I am not sure, maybe what I have done is stupid or an ok attempt. Again to be honest, it's a little beyond me. Any ideas welcomed. I don't mean you @omz, I figure you have...


Re: Virtual display container

I have not had much time to work on this today. But I am trying. Butchering @omz's code :) that's what you get when you pass it over to a beginner. I am making some progress at least in my eyes. I am still trying. Big birthday party to attend tonight, so...


Re: Virtual display container

This may be a starting point... It's basically a scroll view with a grid of cells. Each cell is rendered by a view, but views are only created for cells that are actually visible. When you scroll, so that some cells become invisible, their views are...


Re: Pythonista 1.5 Import Bug?

@ccc, import is tricky for beginners like me. I do the reload(module) etc... Also I have been doing from m import * and from m import foo and import m as xyz. I think the bigger issue for beginners like me to understand is the name space we are creating....


Re: Pythonista 1.5 Import Bug?

[PEP8](https://www.python.org/dev/peps/pep-0008/#imports) and several other Python best practices guides discourage the use of "wildcard imports" (`from module import *`) but if you must... ```python import module from module import * reload(module)...


Re: Pythonista 1.5 Import Bug?

Same solution as http://omz-forums.appspot.com/pythonista/post/5280769899495424 ```python import my_module reload(my_module) ```


Re: Modules working ?

Thanks guys, the reload() trick did it !


Re: Modules working ?

It works as expected for me. Try adding `reload(a)` line just after the import line. Also, make sure the filename is all lowercase.


Re: Modules working ?

The `import` statement caches modules, meaning that if you `import a` more than once (even across different scripts) it will only be loaded once. Because Pythonista runs only a single Python process, this means that if you `import a`, modify `a.py` and...


Re: Trying to isolate my code for different views

I will just mention that for debugging purposes I am calling reload('customers') etc for my .py files that I call setup() in. Just to be sure


Re: Issues with multiple files and detecting changes

When you import in Python, the imported module is indeed cached. You can use `reload` on the imported module, e.g ``` import abc reload (abc) ``` Alternatively, you could use [this](https://github.com/dgelessus/pythonista-...


Stop bottle from caching files

Hi, I'm using `bottle` to serve web pages that load javascript libraries, html and css. It works fine most of the time. However, when I make modifications to the pages it regularly fails to reload the files. Sometimes the caching appears to...


Re: Reload for a "from x import y"

You could also do ```python reload(__import__('x')) from x import y ```


Re: Reload for a "from x import y"

This should work: ```python import x reload(x) from x import y del x # if the name gets in the way ```


Re: Question with motion module

```python import motion reload(motion) # make sure pitch is reset to zero print('''Pythonista's motion.get_attitude() function provides access to the roll, pitch, and yaw of your device. This script uses only the pitch and it will run...