Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when trying to run the .ui application #40

Closed
nbro opened this issue Dec 17, 2014 · 3 comments
Closed

Problem when trying to run the .ui application #40

nbro opened this issue Dec 17, 2014 · 3 comments

Comments

@nbro
Copy link
Contributor

nbro commented Dec 17, 2014

I have used the code you are suggestion to run my "hello.ui" file, but it's not working, and raises the exception "raise Exception('Widget not defined.')" at line 322 of your init.py file under /builder.

This is my hello.ui:

<?xml version='1.0' encoding='utf-8'?>
<interface>
  <object class="ttk.Frame" id="Frame_1">
    <property name="height">200</property>
    <property name="width">200</property>
    <layout>
      <property name="column">0</property>
      <property name="propagate">True</property>
      <property name="row">0</property>
    </layout>
    <child>
      <object class="ttk.Button" id="Button_1">
        <property name="text" translatable="yes">Button_1</property>
        <layout>
          <property name="column">0</property>
          <property name="propagate">True</property>
          <property name="row">0</property>
        </layout>
      </object>
    </child>
  </object>
</interface>

This is the code I am using to run the "hello.ui"

#test.py
import tkinter as tk
import pygubu

class Application:
    def __init__(self, master):

        #1: Create a builder
        self.builder = builder = pygubu.Builder()

        #2: Load an ui file
        builder.add_from_file('hello.ui')

        #3: Create the widget using a master as parent
        self.mainwindow = builder.get_object('mainwindow', master)


if __name__ == '__main__':
    root = tk.Tk()
    app = Application(root)
    root.mainloop()

I am running the application from the main folder of the project. I had also some problems in running the builder/designer, until I did not find the script under /bin in this github repository. I think you should clarify better how to run the builder/designer in your README file.

My OS is Darwin.

Apart from this, would be possible to contribute with my help to this project?

I was thinking also in developing something similar, but my knowledge of tkinter is still not so good, but I would like starting helping you in this project, of course if you don't mind.

If it's ok, it would be great if you could tell me more in details how can I understand better your application, how can study it further, how did you structure the project, so that I am also able to navigate through it without any problems.

@alejandroautalan
Copy link
Owner

Hi dossan, thanks for trying pygubu.

I have used the code you are suggestion to run my "hello.ui" file, but it's not working, and raises the exception "raise Exception('Widget not defined.')" at line 322 of your init.py file under /builder.

The problem here is that your main widget is a ttk.Frame with id = Frame_1, so in your code you must use

self.mainwindow = builder.get_object('Frame_1', master)

Either change the id in the designer or in your code.

I will try to improve the documentation but, in the mean time, there are some useful tips in the wiki about the usage of pygubu and the designer. https://github.com/alejandroautalan/pygubu/wiki

Apart from this, would be possible to contribute with my help to this project?
I was thinking also in developing something similar, but my knowledge of tkinter is still not so good, but I would like starting helping you in this project, of course if you don't mind.

If it's ok, it would be great if you could tell me more in details how can I understand better your application, how can study it further, how did you structure the project, so that I am also able to navigate through it without any problems.

Any contribution is welcome, if you want to change code, feel free to fork the project make your modifications and make pull requests (the github way of work)

I will try to make some docs about the structure of the project for developers but, until then, you can ask me for help.

Regards
Alejandro A.

@zaazbb
Copy link
Contributor

zaazbb commented Dec 18, 2014

docs for developers are needed, i alse want to improve it, but, my English is to bad, and unstand all the codes needs time.

@Dbof
Copy link

Dbof commented Jan 14, 2015

Same problem with your example 'hellowindow.ui'. Frame there has id 'mainframe', your code says 'mainwindow'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants