alejandroautalan / pygubu

A simple GUI builder for the python tkinter module
MIT License
2.04k stars 213 forks source link

Spinbox failed to set property from_ #247

Closed paulocorleone closed 3 years ago

paulocorleone commented 3 years ago

There appears to be an issue when setting the 'from' property of the tk.Spinbox If I choose 'from' = 0 and 'to' = 60 -> no problem

If I choose 'from_' = 1 and 'to' = 60 -> "-tkinter.TclError: -to value must be greater than -from value"

I've attached 3 simple examples, the UI is just a Toplevel and a spinbox. One with just the 'to' property set, another where 'from' is 0 and the last where 'from' is 1. Only the last one gives the error, from what I can tell, as soon as 'from_' is positive, we get the error. spinbox from to issue.zip

Using a RPi4, with Debian and latest Pygubu

pi@raspberrypi:~ $ pygubu-designer TEMPLATE_DIR /usr/local/lib/python3.7/dist-packages/pygubudesigner/template python: 3.7.3 on linux pygubu: 0.11 pygubu-designer: 0.17

Here's the traceback I get:

pi@raspberrypi:~ $ pygubu-designer TEMPLATE_DIR /usr/local/lib/python3.7/dist-packages/pygubudesigner/template python: 3.7.3 on linux pygubu: 0.11 pygubu-designer: 0.17 --- Logging error --- Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/builderobject.py", line 188, in _set_property target_widget[pname] = propvalue File "/usr/lib/python3.7/tkinter/init.py", line 1492, in setitem self.configure({key: value}) File "/usr/lib/python3.7/tkinter/init.py", line 1485, in configure return self._configure('configure', cnf, kw) File "/usr/lib/python3.7/tkinter/init.py", line 1476, in _configure self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) _tkinter.TclError: -to value must be greater than -from value

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 130, in emit msg = self.format(record) File "/usr/lib/python3.7/logging/init.py", line 880, in format return fmt.format(record) File "/usr/lib/python3.7/logging/init.py", line 619, in format record.message = record.getMessage() File "/usr/lib/python3.7/logging/init.py", line 380, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "/usr/local/bin/pygubu-designer", line 10, in sys.exit(start_pygubu()) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 758, in start_pygubu app.run() File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 347, in run self.mainwindow.mainloop() File "/usr/lib/python3.7/tkinter/init.py", line 1283, in mainloop self.tk.mainloop(n) File "/usr/lib/python3.7/tkinter/init.py", line 1705, in call return self.func(args) File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/builderobject.py", line 255, in widget_callback command(button_id) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 619, in on_file_menuitem_clicked self.mainwindow.event_generate(action) File "/usr/lib/python3.7/tkinter/init.py", line 1673, in event_generate self.tk.call(args) File "/usr/lib/python3.7/tkinter/init.py", line 1705, in call return self.func(args) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 315, in w.bind(actions.FILE_OPEN, lambda e: self.do_file_open()) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 594, in do_file_open self.load_file(filename) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 573, in load_file self.tree_editor.load_file(filename) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/uitreeeditor.py", line 673, in load_file self.draw_widget(child) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/uitreeeditor.py", line 255, in draw_widget self.previewer.draw(item, widget_id, uidef, wclass) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/previewer.py", line 624, in draw preview.update(widget_id, uidefinition) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/previewer.py", line 243, in update self.create_preview_widget(canvas_window, widget_id, uidefinition) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/previewer.py", line 455, in create_preview_widget widget = self.builder.get_object(widget_id, parent) File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/init.py", line 164, in get_object bobject = self._realize(root, wmeta) File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/init.py", line 211, in _realize child = self._realize(parent, childmeta) File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/init.py", line 213, in _realize parent.configure() File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/tkstdwidgets.py", line 453, in configure super(TKSpinbox, self).configure() File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/builderobject.py", line 163, in configure self._set_property(target, pname, pvalue) File "/usr/local/lib/python3.7/dist-packages/pygubu/builder/builderobject.py", line 191, in _setproperty logger.error(msg, pname, repr(self.class)) File "/usr/lib/python3.7/logging/init.py", line 1412, in error self._log(ERROR, msg, args, **kwargs) File "/usr/lib/python3.7/logging/init.py", line 1519, in log self.handle(record) File "/usr/lib/python3.7/logging/init.py", line 1529, in handle self.callHandlers(record) File "/usr/lib/python3.7/logging/init.py", line 1591, in callHandlers hdlr.handle(record) File "/usr/lib/python3.7/logging/init.py", line 905, in handle self.emit(record) File "/usr/local/lib/python3.7/dist-packages/pygubudesigner/main.py", line 135, in emit self.handleError(record) Message: "Failed to set property '{0}' on class '{1}'. TclError:" Arguments: ('from', "<class 'tkinter.Spinbox'>")

alejandroautalan commented 3 years ago

Hello Paulo, thanks for trying pygubu and for the bug report. I will review it and fix it ASAP.

Regards Alejandro A.