What's new

Creating a custom button

I am pretty new to python and Alibre Script and I am trying to build a GUI.
My goal is to create a custom button which should be able to perform a custom action (deleting a file on button press).
At first I tried doing that with the native WindowsInputTypes. Then I tried importing a module called 'tkinter'. That didn't work aswell.

Is there any way I can implement that button

Thanks in advance
Daniel
 

NateLiquidGravity

Alibre Super User
It is possible but very complicated. The short version is that you will need to import and create 'System.Windows.Forms'.
Here is a script I made with a custom GUI.
 

idslk

Alibre Super User
I am trying to build a GUI.
What kind of GUI are you thinking about?
For a lot of things AlibreScript is easy to use.
Selecting a file and deleting it is possible with AlibreScript, but maybe quicker if you do it with windows directly...
If you want to do more complex things i would recoment to think about AddOn programming.
But beware, also there you do not have access to all functions of alibre...

Regards
Stefan
 
What kind of GUI are you thinking about?
For a lot of things AlibreScript is easy to use.
Selecting a file and deleting it is possible with AlibreScript, but maybe quicker if you do it with windows directly...
If you want to do more complex things i would recoment to think about AddOn programming.
But beware, also there you do not have access to all functions of alibre...

Regards
Stefan
I am trying to create a GUI where the User can export his current part to a file.
This program also needs to create and read a .ini file, which is needed to save some Information. My custom button should delete this Ini file on button press.
Currently, I am trying to accomplish that with Windows Forms but apparently the OpenFileDialog function doesn't want to start working.
In the attachment below, I found a script that contains the OpenFileDialog function, but it doesn't work either.

Thanks
Daniel
 

Attachments

  • SimpleDialog.py
    1.1 KB · Views: 4

NateLiquidGravity

Alibre Super User
I am trying to create a GUI where the User can export his current part to a file.
This program also needs to create and read a .ini file, which is needed to save some Information. My custom button should delete this Ini file on button press.
Currently, I am trying to accomplish that with Windows Forms but apparently the OpenFileDialog function doesn't want to start working.
In the attachment below, I found a script that contains the OpenFileDialog function, but it doesn't work either.

Thanks
Daniel

I assume you want the AlibreScript OpenFileDialog function?
Python:
Win = Windows()
Value = Win.OpenFileDialog('Title',  'Part Files|*.AD_PRT', '.AD_PRT')
if not Value:
    inputFile.Text = ''
else:
    inputFile.Text = str(Value)
1657901905871.png
 
Top