alejandroautalan / pygubu-designer

A simple GUI designer for the python tkinter module
GNU General Public License v3.0
800 stars 98 forks source link

widget id not being generated for custom widgets #205

Closed AJ6CU closed 7 months ago

AJ6CU commented 1 year ago

Describe the bug Tried using widget-id option for button callback to reuse a callback. The callback function definition does appear to have the widget-id parameter. However, the "command=..." just has a straight function with no parameters (did you intend to generate a lambda here with the widget-id?

To Reproduce Steps to reproduce the behavior: See attached .ui fle Generate it as a custom widget. Generated code is:

!/usr/bin/python3

import tkinter as tk import tkinter.ttk as ttk

class WidgetidWidget(tk.Toplevel): def init(self, master=None, kw): super(WidgetidWidget, self).init(master, kw) self.button1 = ttk.Button(self) self.button1.configure(text='button1') self.button1.pack(side="top") self.button1.configure(command=self.testcallback) self.configure(height=200, width=200)

def testcallback(self, widget_id):
    pass

if name == "main": root = tk.Tk() widget = WidgetidWidget(root) widget.pack(expand=True, fill="both") root.mainloop()

Your Environment (please complete the following information):

Additional context Add any other context about the problem here.

alejandroautalan commented 7 months ago

Fixed in pygubu v0.32