Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8571181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:43:35+00:00 2026-06-11T18:43:35+00:00

I am trying to copy some of the code from the example included in

  • 0

I am trying to copy some of the code from the example included in this page and modify it to run on iron python using some help from these tutorials. But I’m stuck as when stepping outside the tutorials, I don’t know what modules I need to be importing.

At the moment I have the following code

import clr
clr.AddReference("System.Drawing")
clr.AddReference("System.Windows.Forms")

from System.Windows.Forms import Application, Form, Button, Label, DockStyle, AnchorStyles, Panel, Screen, FlowLayoutPanel

class OKWindow(Form):
   def __init__(self,InfoTXT):
      newlines = 0
      screenSize = Screen.GetWorkingArea(self)
      STRwidth = 200
      STRheight = 30
      FORMheight = 160 
      FORMwidth = 300
      self.Text = 'Information'
      self.Height = FORMheight
      self.Width = FORMwidth


      self.flowPanel = FlowLayoutPanel()
      #self.flowPanel.AutoSize = true
      #self.flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink
      self.Controls.Add(flowPanel)

      label = Label()
      label.Text = InfoTXT
      label.Top = 30
      label.Left = 50
      label.Height = STRheight
      label.Width = STRwidth

      button = Button()
      button.Text = "OK"
      button.Width = 100
      button.Top = FORMheight - 80
      button.Left = (FORMwidth / 2) - 50
      print button.Anchor
      button.Anchor = AnchorStyles.Bottom

      button.Click += self.buttonPressed

      self.Controls.Add(label)
      self.Controls.Add(button)

   def buttonPressed(self, sender, args):
      Application.Exit()

def information(Message):
   Application.EnableVisualStyles()
   form = OKWindow(Message)
   Application.Run(form)

(Note: The code is not exact as it’s currently running within OCTGN’s iron python scripting engine. I call the information() function from elsewhere with some text such as information('Important Announcement').)

So the code aborts as soon as I try to execute this self.flowPanel = FlowLayoutPanel(). If I comment out the flowPanel lines, the windows form appears normally.

So it seems to me that I haven’t imported the module that is needed properly. Unfortunately I have no idea what to load. I tried loading whatever I thought would be the right one, but none seem to work for me.

How can I figure out what module to import from System.Windows.Forms in order to create a FlowLayoutPanel in my code? And in general how does one figure out what to import in order to get the relevant functionality?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:43:36+00:00Added an answer on June 11, 2026 at 6:43 pm

    The answer seems to be that it’s whatever is after the third dot ‘.’ in System.Windows.Forms

    So to use System.Windows.Forms.Form, you need to import Form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to copy over some example code into my own project. The example
I am trying copy some words from memory and saving it to another memory
I'm trying to write some code that will be run by the 'admin' user
I'm trying to copy some text to xml file. The problem is that all
I got some troubles trying to copy char to char... Here's args[] definition :
I'm trying to copy a UIView with some properties. The UIView is overriding the
I'm trying copy a single file from the Plugin directory inside of my Wordpress
I am trying to copy all format file (.txt,.pdf,.doc ...) file from source folder
I am trying to copy files from a directory that is in constant use
I'm trying to copy files to C:\Windows\System32 using cygwin bash. When I copy files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.