More issues with forms and Python upgrades

I gave up with the task dialog and went to winforms…

But have now discovered the Py3 in Dynamo is more long winded!!

Greyed out was the old code from IronPython and the ungreyed code is what I have to put now. :frowning:

BUT… I can’t seem to set the font style. I just get an error if I place it in the Font brackets. Any idea?

I’ve tried several variations.

image

label.Font = Font(“Arial”, 12, “Bold”)
label.Font = Font(“Arial”, 12, Font.Style.Bold)
label.Font.Bold = Font(“Arial”, 12)
label.Font.Style.Bold = Font(“Arial”, 12) {getting desperate}
label.Font= Font(“Arial”, 12, Style.Bold)

            label.Font= Font("Arial", 12)
            label.Font.Style = "Bold

label.Font= Font.Style(“Arial”, 12, FontStyle.Bold)
label.Font= Font(“Arial”, 12, FontStyle.Bold)

All of the above give errors…

Then some variations don’t give errors but do nothing.

            label.Font = Font("Arial", 12)
            label.FontStyle = ("Bold")

Hi, by looking at Mr. Poupin’s article with SharpDevellop you have access to the code

Sincerely
christian.stan

self._label1.Font = System.Drawing.Font("Microsoft Sans Serif", 12, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0)

2 Likes

Thanks, I’ll check that out.

I just closed it in frustration!

I can’t seem to get anything but the most basic things to work!

I want to know why it’s not like actual Python!

1 Like

Sorry for not doing better, 100% true python, I still have big gaps

cordially
christian.stan

Can’t say I’m overly enamoured with the ‘upgrade’

In my experience when there is a security driven update the coders suffer more than end users; doubly so when the update forces you to change multiple items at once (Python Engine and Python version).

For what it’s worth, this will make your inevitable evolution into C# easier…

1 Like

My ‘evolution’ to C# is going painfully slow…
Think a geriatric snail who keeps getting sidetracked. :snail:

Everyone moves at their own pace. Some jumped quickly (Konrad Sobon). Some may never leave Python (Andreas Dieckmann). I just built my first “real” package with it this fall.

Don’t look to others, but focus on your needs and end goals. :slight_smile:

I made an add-in for Revit with some fun images (bunch of useful company links)

image

I keep meaning to add more stuff… But the side tracked thing is a huge issue. :rofl:

1 Like

The problem does not come from Python3 (IronPython3 has no problems at this subject) but from the version of PythonNet currently used

PythonNet 2.5 vs PythonNet 3.0 example

if there is no solution in the future, maybe a C# script OTB interpreter node might be welcome

2 Likes

If you have it compiled in C# you can just load in the DLL… that said a series of common iInterfaceThing nodes might be a good addition to Dynamo for Revit, to allow users to pass them as inputs into Python nodes… :thinking:

I was thinking more of a solution like this

I think both solutions have advantages,

2 Likes