Hi there,
I am trying to port my rhinoscripts from ironPython2.7 to python3 in rhino8. I often use a mechanism that inherits multiple parent classes to combine Eto.Forms.Dialog and Eto.Forms.Form.
When I run the script below in python3, I expect the “SampleEtoRoomNumberDialog” to inherit the method “OnOKButtonClick” from ParentDialog, but instead I get the error message:
AttributeError: ‘0, Culture=neutral, PublicKeyToken=7cec85d7bea77’ object has no attribute ‘OnOKButtonClick’
(The script works fine in Rhin8 / IronPython2.7)
Can anyone please help me out?
Thanks!
Tim
# Imports
import Rhino
from Eto import Forms as forms
class ParentDialog(object):
# OK button click handler
def OnOKButtonClick(self, sender, e):
self.Close(True)
# SampleEtoRoomNumber dialog class
class SampleEtoRoomNumberDialog(forms.Dialog[bool], ParentDialog):
# Dialog box Class initializer
def __init__(self):
super(SampleEtoRoomNumberDialog, self).__init__()
# Create the default button
self.DefaultButton = forms.Button()
self.DefaultButton.Text = 'OK'
self.DefaultButton.Click += self.OnOKButtonClick
# Create a table layout and add all the controls
layout = forms.DynamicLayout()
layout.AddRow(self.DefaultButton)
# Set the dialog content
self.Content = layout
def main():
dialog = SampleEtoRoomNumberDialog();
rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
if __name__ == "__main__":
main()
1 post - 1 participant