skip to Main Content

I have installed gnuhealth and when I run the gnuhealthclient and login with my username and password it shows an error message with gtk problem : no module found

I am using centos 7 and I already installed gtk+ and gtk3 with these commands:

$sudo yum install gtk3

$sudo yum install gtk3-devel

$sudo yum install gtk+

When I check the list of installed packages I found gtk+ and gtk3 and even gtk 2

Can anyone tell me what is the problem?

Here’s the error msg:


    if not self.screen.row_activate() and self.children_field:

  File "/home/gnuhealth/.local/lib/python3.6/site-packages/tryton/gui/main.py", line 707, in menu_row_activate

    }, warning=False)

  File "/home/gnuhealth/.local/lib/python3.6/site-packages/tryton/action/main.py", line 195, in exec_keyword

    Action._exec_action(action, data, context=context)

  File "/home/gnuhealth/.local/lib/python3.6/site-packages/tryton/action/main.py", line 155, in _exec_action

    context_domain=action['context_domain'])

  File "/home/gnuhealth/.local/lib/python3.6/site-packages/tryton/gui/window/window.py", line 31, in create

    from .form import Form

  File "/home/gnuhealth/.local/lib/python3.6/site-packages/tryton/gui/window/form.py", line 9, in <module>

    import gtk
ModuleNotFoundError: No module named 'gtk'```

2

Answers


  1. Your .py files should enclose

    import gtk

    that should be replaced by

    from gi.repository import Gtk

    In Gnuhealth source code, some files enclose both of libraries calls, others just call the gtk library without precising the source repository. The code is not very clean.

    Thanks to these explanations here :
    gi.repository is the Python module for PyGObject (which stands for Python GObject introspection) which holds Python bindings and support for the GTK+ 3 toolkit and for the GNOME apps

    Login or Signup to reply.
  2. First import gi

    import gi
    

    Set the required version needed

    gi.require_version('Gtk', '3.0')
    

    Finally

    from gi.repository import Gtk
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search