Code Monkey home page Code Monkey logo

toga-demo's People

Contributors

apollo13 avatar freakboy3742 avatar glasnt avatar moritz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

toga-demo's Issues

Fedora support?

I installed the following depedencies:

dnf install python3-gobject pywebkitgtk

But I can’t get the demo running:

(toga) $ toga-demo
Traceback (most recent call last):
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_gtk/app.py", line 8, in <module>
    import gi
ImportError: No module named 'gi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/envs/toga/bin/toga-demo", line 7, in <module>
    from toga_demo.__main__ import main
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_demo/__main__.py", line 6, in <module>
    from .app import TogaDemo
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_demo/app.py", line 4, in <module>
    import toga
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga/__init__.py", line 91, in <module>
    set_platform()
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga/__init__.py", line 73, in set_platform
    locals['platform'] = importlib.import_module(module_name)
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_gtk/__init__.py", line 2, in <module>
    from .app import *
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_gtk/app.py", line 60, in <module>
    raise RuntimeError("Unable to locate the Python GTK+ bindings. Have you run '%s'?" % installer_command)
RuntimeError: Unable to locate the Python GTK+ bindings. Have you run 'pacman -S python-gobject'?

pip install gi

(toga) toga-demo --version
Traceback (most recent call last):
  File "/opt/envs/toga/bin/toga-demo", line 7, in <module>
    from toga_demo.__main__ import main
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_demo/__main__.py", line 6, in <module>
    from .app import TogaDemo
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_demo/app.py", line 4, in <module>
    import toga
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga/__init__.py", line 91, in <module>
    set_platform()
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga/__init__.py", line 73, in set_platform
    locals['platform'] = importlib.import_module(module_name)
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_gtk/__init__.py", line 2, in <module>
    from .app import *
  File "/opt/envs/toga/lib64/python3.5/site-packages/toga_gtk/app.py", line 8, in <module>
    import gi
  File "/opt/envs/toga/lib64/python3.5/site-packages/gi/__init__.py", line 39
    print url
            ^
SyntaxError: Missing parentheses in call to 'print'
(toga) $ python
Python 3.5.2 (default, Sep 14 2016, 11:28:32) 
[GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

AttributeError on OSX 10.9.4 and Python 3.4.1

I get the following error when I try to run toga-demo using OSX 10.9.4 and Python 3.4 (no issues with Python 2.7.5):

(env)185:test colin$ toga-demo
Traceback (most recent call last):
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/libs/objc.py", line 841, in has_property
return self.properties[name]
KeyError: b'initWithContentsOfFile_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/colin/Programming/python/test/env/bin/toga-demo", line 7, in
from toga_demo.main import main
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga_demo/main.py", line 8, in
import toga
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/init.py", line 80, in
from .platform.cocoa.app import *
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/app.py", line 7, in
from .widgets import Icon, TIBERIUS_ICON
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/widgets/init.py", line 5, in
from .icon import *
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/widgets/icon.py", line 32, in
TIBERIUS_ICON = Icon('tiberius.icns', system=True)
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/widgets/icon.py", line 18, in init
self.impl = NSImage.alloc().initWithContentsOfFile(get_NSString(filename))
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/libs/objc.py", line 936, in getattr
if self.objc_class.has_property(name):
File "/Users/colin/Programming/python/test/env/lib/python3.4/site-packages/toga/platform/cocoa/libs/objc.py", line 843, in has_property
selector = get_selector('set' + name[0].upper() + name[1:] + ':')
AttributeError: 'int' object has no attribute 'upper'

toga-demo fails with gtk backend

I am getting this on debian stable:

Traceback (most recent call last):
  File "/home/florian/.local/lib/python3.4/site-packages/toga_gtk/app.py", line 123, in _startup
    self.startup()
  File "/home/florian/.local/lib/python3.4/site-packages/toga_demo/app.py", line 42, in startup
    right_content.add(toga.Button('Hello world %s' % b, on_press=self.button_handler, style=CSS(margin=20)))
  File "/home/florian/.local/lib/python3.4/site-packages/toga_gtk/widgets/button.py", line 12, in __init__
    self._create()
  File "/home/florian/.local/lib/python3.4/site-packages/toga/interface/widgets/base.py", line 136, in _create
    self._configure(**self._config)
  File "/home/florian/.local/lib/python3.4/site-packages/toga/interface/widgets/button.py", line 9, in _configure
    self.label = label
  File "/home/florian/.local/lib/python3.4/site-packages/toga/interface/widgets/button.py", line 22, in label
    self._set_label(value)
  File "/home/florian/.local/lib/python3.4/site-packages/toga_gtk/widgets/button.py", line 22, in _set_label
    self.rehint()
  File "/home/florian/.local/lib/python3.4/site-packages/toga_gtk/widgets/button.py", line 33, in rehint
    if width.minimum_width > 0:
AttributeError: 'tuple' object has no attribute 'minimum_width'

Seems like width is not what it is supposed to be, I'll take a look later, this is just so it does not get lost :D

Fedora 24 only has the 4.0 Webkit2 bindings, causing toga-demo to fail

Thanks for the Gtk support! Unfortunately, the demo is failing to find the WebKit bindings on Fedora, and the number of different projects and version numbers interacting, as well as the major naming differences between Debian and Fedora in this area, makes it hard to figure out what it's actually looking for:

$ toga-demo
Traceback (most recent call last):
  File "/home/ncoghlan/.local/bin/toga-demo", line 7, in <module>
    from toga_demo.__main__ import main
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga_demo/__main__.py", line 6, in <module>
    from .app import TogaDemo
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga_demo/app.py", line 4, in <module>
    import toga
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga/__init__.py", line 91, in <module>
    set_platform()
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga/__init__.py", line 73, in set_platform
    locals['platform'] = importlib.import_module(module_name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga_gtk/__init__.py", line 20, in <module>
    from .widgets.webview import *
  File "/home/ncoghlan/.local/lib/python2.7/site-packages/toga_gtk/widgets/webview.py", line 8, in <module>
    gi.require_version('WebKit2', '3.0')
  File "/usr/lib64/python2.7/site-packages/gi/__init__.py", line 106, in require_version
    (namespace, version))
ValueError: Namespace WebKit2 not available for version 3.0

gir1.2-webkit2-3.0 seems to be the relevant Debian package (which is mentioned on toga's Gtk support page), and looking at https://packages.debian.org/sid/gir1.2-webkit2-4.0 shows that's the Gobject introspection bindings for WebKit2 3.0

However, I can't find anything similar for Fedora, which suggests this may work quite differently on non-Debian derived Linux systems.

tar.gz source of version 0.1.0 on Pypi doesn't include icons

Installed toga-demo on Ubuntu 12.04.1 in a brand new virtualenv; pip used the source tar.gz package.
Upon launching "toga-demo" from the CLI it crashes due to missing icons. After checking it looks like the icons are indeed missing from the source package on Pypi. This did not happen on OSX 10.8 where the wheel package gets used by pip and everything installs and runs fine.

(toga)cdoussin@lsdev:~$ toga-demo
Traceback (most recent call last):
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga/platform/gtk/app.py", line 27, in _startup
    self.main_window.app = self
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga/platform/gtk/window.py", line 61, in app
    self._startup()
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga/platform/gtk/window.py", line 36, in _startup
    item_impl.set_icon_widget(toolbar_item.icon._impl_32)
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga/platform/gtk/widgets/icon.py", line 33, in <lambda>
    _impl_32 = property(lambda self: self.__impl(32))
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga/platform/gtk/widgets/icon.py", line 28, in __impl
    GdkPixbuf.Pixbuf.new_from_file(self._filename).scale_simple(size, size, GdkPixbuf.InterpType.BILINEAR)
  File "/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/gi/types.py", line 72, in constructor
    return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Failed to open file '/home/cdoussin/Code/envs/toga/local/lib/python2.7/site-packages/toga_demo/icons/brutus-32.png': No such file or directory
(toga)cdoussin@lsdev:~$ 

toga-demo fails on debian 8 with python 3.4

Creating symlink (/home/moritz/projects/toga_venv/lib/python3.4/site-packages/gi & /home/moritz/projects/toga_venv/lib/python3.4/site-packages/pygtkcompat) to system GTK+ libraries...

(toga-demo:13991): GLib-GIO-CRITICAL **: g_application_set_application_id: assertion 'application_id == NULL || g_application_id_is_valid (application_id)' failed
Traceback (most recent call last):
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_gtk/widgets/icon.py", line 20, in __impl
    return self._impl_cache[size]
KeyError: 32

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_gtk/app.py", line 139, in _startup
    self.startup()
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_demo/app.py", line 55, in startup
    self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2]
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga/interface/window.py", line 127, in toolbar
    self._set_toolbar(items)
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_gtk/window.py", line 42, in _set_toolbar
    item_impl.set_icon_widget(toolbar_item.icon._impl_32)
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_gtk/widgets/icon.py", line 28, in <lambda>
    _impl_32 = property(lambda self: self.__impl(32))
  File "/home/moritz/projects/toga_venv/lib/python3.4/site-packages/toga_gtk/widgets/icon.py", line 23, in __impl
    GdkPixbuf.Pixbuf.new_from_file(self._filename).scale_simple(size, size, GdkPixbuf.InterpType.BILINEAR)
GLib.Error: g-file-error-quark: Datei »/home/moritz/projects/toga_venv/lib/python3.4/site-packages/resources/tiberius.icns« konnte nicht geöffnet werden: Datei oder Verzeichnis nicht gefunden (4)

toga-demo 0.2.14 problem with toga.SEPARATOR

I tried running the toga-demo 0.2.14 with python3.6.2 under OS X 10.12.6 and got this traceback

Traceback (most recent call last):
File "toga214/bin/toga-demo", line 11, in
sys.exit(run())
File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_demo/main.py", line 5, in run
main().main_loop()
File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 167, in main_loop
self._startup()
File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 118, in _startup
self.startup()
File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_demo/app.py", line 55, in startup
self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2]
AttributeError: module 'toga' has no attribute 'SEPARATOR'

The demo runs and buttons and menus work after changing line 55 in toga_demo/app.py from
self.main_window.toolbar = [cmd1, toga.SEPARATOR, cmd2]
to
self.main_window.toolbar.add(cmd1, cmd2)

but it displays this traceback in the Terminal

Traceback (most recent call last):
File "_ctypes/callbacks.c", line 234, in 'calling callback function'
File "/Users/selasley/toga214/lib/python3.6/site-packages/rubicon/objc/objc.py", line 1050, in objc_method
result = f(py_self, *args)
File "/Users/selasley/toga214/lib/python3.6/site-packages/toga_cocoa/app.py", line 55, in application_openFiles

for i in range(0, len(filenames)):
TypeError: object of type 'ObjCInstance' has no len()

This traceback is also displayed for the scripts in the toga tutorial.

Thanks for creating toga and the whole BeeWare project.

toga-demo 'toga.constraint' error windows python3.5.2

executing toga-demo in command prompt gives the following error:

(VEpy35) C:\Users\lewis\VEpy35\Lib\site-packages>toga-demo
Traceback (most recent call last):
File "C:\Python35\lib\runpy.py", line 184, in run_module_as_main
"main", mod_spec)
File "C:\Python35\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\users\lewis\VEpy35\Scripts\toga-demo.exe__main
.py", line 5, in
File "c:\users\lewis\vepy35\lib\site-packages\toga_demo__main__.py", line 6,
in
from .app import TogaDemo
File "c:\users\lewis\vepy35\lib\site-packages\toga_demo\app.py", line 4, in
import toga
File "c:\users\lewis\vepy35\lib\site-packages\toga__init__.py", line 91, in
set_platform()
File "c:\users\lewis\vepy35\lib\site-packages\toga__init__.py", line 73, in set_platform
locals['platform'] = importlib.import_module(module_name)
File "C:\Python35\lib\importlib__init__.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "c:\users\lewis\vepy35\lib\site-packages\toga_win32__init
.py", line 7, in
from .widgets.button import *
File "c:\users\lewis\vepy35\lib\site-packages\toga_win32\widgets\button.py", line 5, in
from .base import Widget
File "c:\users\lewis\vepy35\lib\site-packages\toga_win32\widgets\base.py", line 3, in
from toga_cassowary.widget import Widget as CassowaryWidget
File "c:\users\lewis\vepy35\lib\site-packages\toga_cassowary\widget.py", line
3, in
from toga.constraint import Attribute, Constraint
ImportError: No module named 'toga.constraint'

toga-demo error in windows with python3.5 32-bit

executing toga-demo in command prompt gives the following error:

REQUEST FOR MIN MAX INFO
1 1771694
2 1771694
Traceback (most recent call last):
  File "c:\python35-32\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python35-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python35-32\Scripts\toga-demo.exe\__main__.py", line 9, in <module>
  File "c:\python35-32\lib\site-packages\toga_demo\__main__.py", line 90, in main
    app = DemoApp('Toga Demo', 'org.pybee.toga-demo')
  File "c:\python35-32\lib\site-packages\toga_win32\app.py", line 19, in __init__
    self._startup()
  File "c:\python35-32\lib\site-packages\toga_win32\app.py", line 25, in _startup
    self.startup()
  File "c:\python35-32\lib\site-packages\toga_demo\__main__.py", line 13, in startup
    left_container = toga.OptionContainer()
AttributeError: module 'toga' has no attribute 'OptionContainer'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.