Windows Forms PictureBox y Group

if I did not answer immediately, it is so that you try for yourself with the links given above :slightly_smiling_face:

here an example

import sys
import clr
import System
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System.Drawing import Point, Image, Bitmap, Size
from System.Windows.Forms import Application, Button, Form, Label, TextBox

class SimpleTextBoxForm(Form):
    def __init__(self, valueA, valueB, imgpath):
        self._imgpath = imgpath
        self._valueInitA = str(valueA)
        self._valueInitB = str(valueB) 
        self._pictureBox1 = System.Windows.Forms.PictureBox()
        self._pictureBox1.BeginInit()

        self.Width = 220
        self.Height = 300

        self.textbox = TextBox()
        self.textbox.Text = self._valueInitA
        self.textbox.Location = Point(25, 25)
        self.textbox.Width = 150

        self.textbox1 = TextBox()
        self.textbox1.Text = self._valueInitB
        self.textbox1.Location = Point(25, 55)
        self.textbox1.Width = 150

        self._imageTop = Image.FromFile(self._imgpath)
        self._imageTopResize = Bitmap(self._imageTop, Size(100, 100))
        self._pictureBox1.Location = System.Drawing.Point(45, 90)
        self._pictureBox1.Name = "pictureBox1"
        self._pictureBox1.Size = System.Drawing.Size(100, 100)
        self._pictureBox1.TabIndex = 0
        self._pictureBox1.TabStop = False
        self._pictureBox1.Image = self._imageTopResize

        self.button1 = Button()
        self.button1.Text = 'Press Me'
        self.button1.Location = Point(25, 230)
        
        self.AcceptButton = self.button1

        self.Controls.Add(self.textbox)
        self.Controls.Add(self.textbox1)
        self.Controls.Add(self.button1)
        self.Controls.Add(self._pictureBox1)

        self.values = []
        self.button1.Click += self.update
        self._pictureBox1.EndInit()

    def update(self, sender, event):
        for control in self.Controls:
            if isinstance(control, TextBox):
              self.values.append(control.Text)
        self.Close()

form = SimpleTextBoxForm(IN[0], IN[1], IN[2])
form.ShowDialog()

OUT = form.values
4 Likes