Welcome, Guest
A place to meet other Developers
  • Page:
  • 1
  • 2

TOPIC: Windows forms with Python

Windows forms with Python 4 years 7 months ago #30838

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
I would like to give my scripts a nice GUI but do not know where to start. Is there a good tutorial on the web how to design Windows forms with IronPython and Visual Studio / SharpDeveloper?

Any help is highly appreciated!
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #30948

  • cbanack
  • cbanack's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1318
  • Thank you received: 503
  • Karma: 181
The trick is, you are actually going to be writing the GUI with .NET. IronPython is just one of a number of different languages that you can use to access the .NET API, and it's the one you have to use to write ComicRack scripts. So really you have to learn two things at once: 1) how to create GUIs with .NET (Windows Forms) and 2) how to use IronPython to work with .NET.

There's a website called the IronPython cookbook that has some useful examples to get you started. Microsoft's .NET documentation is essential, too.
Last Edit: 4 years 6 months ago by cbanack.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #30953

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
Thanks cbanack. I had some experience with .Net before. The hard thing to learn was to build Windows forms for Python without a forms designer. Well, I took my lessons the last days and the results will be public with the first beta release ComicRack Data Manager plugin tomorrow.
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
Last Edit: 4 years 6 months ago by docdoom.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31404

  • gdison
  • gdison's Avatar
  • Offline
  • Junior Boarder
  • Posts: 21
  • Karma: 0
The quickest and handy way to do this is by creating a normal Windows From application, design your from/s graphically benefiting from the VS GUI designer. Then when you are done , just have a look at the generated class file with the form name followed by ‘.Designer.cs’ extension (e.g. Form1.Designer.cs), specifically under ‘InitializeComponent’ method where you can find all the controls and the form initialisation code. Copy these and replace and modify them ,as needed, with py code.
I have attached a sample Windows Form app (it’s 2012 project but it will work with any other lower version as well) and the Python form created out of it.
Attachments:
Last Edit: 4 years 6 months ago by gdison.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31405

  • Freakeao
  • Freakeao's Avatar
  • Offline
  • Gold Boarder
  • Posts: 199
  • Thank you received: 25
  • Karma: 6
I've used SharpDevelop to do that same thing. But you can make it a python project so you don't have to modified the form generated code at all. just copy the file into your plugin project.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31408

  • gdison
  • gdison's Avatar
  • Offline
  • Junior Boarder
  • Posts: 21
  • Karma: 0
you are right about making it as python project but the point is you are going to lose what the graphical designer has to offer you (you know dragging, resizing, modifying properties..etc. visually) instead of hard coding them manually, run it to see how it looks then restart the process again (python project doesn't has a graphical designer).
Last Edit: 4 years 6 months ago by gdison.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31412

  • Freakeao
  • Freakeao's Avatar
  • Offline
  • Gold Boarder
  • Posts: 199
  • Thank you received: 25
  • Karma: 6
It does in SharpDevelop.... If I recall correctly.... Been a while since I did that.
Last Edit: 4 years 6 months ago by Freakeao.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31416

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
yeah well i can't manage to get SharpDevelop to watch values when debugging, (Any tips on how to make that happen) so i build with SharpDevelop and debug with Visual Studio. problem with that is is if i edit in Visual Studio it complains about indentation (apparently the method of indentation in SharpDevelop & Visual Studio are incompatible)

So I have a question. how do i make ComicRack reinitialize the script everytime so i don't have to restart ComicRack everytime i run into a bug?
Last Edit: 4 years 6 months ago by T3KN0Gh057.
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31482

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
T3KN0Gh057 wrote:
So I have a question. how do i make ComicRack reinitialize the script everytime so i don't have to restart ComicRack everytime i run into a bug?

Take a look at comicrack.cyolito.com/wiki/doku.php?id=d...oping_scripts_basics how to use the arguments -dso -ssc with ComicRack.
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
The administrator has disabled public write access.

Re: Windows forms with Python 4 years 6 months ago #31483

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
got both of those set, everytime i run into a bug it's fix bug and then restart script, bug still exists (even though it's no longer in the file... because ComicRack is using it's first compile of the script still
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.206 seconds

Who's Online

We have 200 guests and 7 members online