16/05/2014, 15:31
|
| | Fecha de Ingreso: mayo-2014
Mensajes: 6
Antigüedad: 10 años, 6 meses Puntos: 0 | |
Respuesta: duda sobre acciones y MainForm Hola Principe_Azul gracias por tu pronta respuesta, según yo estoy utilizando .net
Este sería mi programa; Cita: import System.Drawing
import System.Windows.Forms
from System.Drawing import *
from System.Windows.Forms import *
class MainForm(Form):
def __init__(self):
self.InitializeComponent()
def InitializeComponent(self):
self._label1 = System.Windows.Forms.Label()
self._panel1 = System.Windows.Forms.Panel()
self._groupBox1 = System.Windows.Forms.GroupBox()
self._listBox1 = System.Windows.Forms.ListBox()
self._groupBox2 = System.Windows.Forms.GroupBox()
self._textBox1 = System.Windows.Forms.TextBox()
self._label2 = System.Windows.Forms.Label()
self._button1 = System.Windows.Forms.Button()
self._groupBox3 = System.Windows.Forms.GroupBox()
self._label3 = System.Windows.Forms.Label()
self._textBox2 = System.Windows.Forms.TextBox()
self._textBox3 = System.Windows.Forms.TextBox()
self._label4 = System.Windows.Forms.Label()
self._button2 = System.Windows.Forms.Button()
self._button3 = System.Windows.Forms.Button()
self._button4 = System.Windows.Forms.Button()
self._button5 = System.Windows.Forms.Button()
self._panel1.SuspendLayout()
self._groupBox1.SuspendLayout()
self._groupBox2.SuspendLayout()
self._groupBox3.SuspendLayout()
self.SuspendLayout()
#
# label1
#
self._label1.Font = System.Drawing.Font("Microsoft Sans Serif", 26.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
self._label1.Location = System.Drawing.Point(12, 9)
self._label1.Name = "label1"
self._label1.Size = System.Drawing.Size(616, 40)
self._label1.TabIndex = 0
self._label1.Text = "Diccionario de programación"
self._label1.Click += self.Label1Click
#
# panel1
#
self._panel1.Controls.Add(self._groupBox3)
self._panel1.Controls.Add(self._groupBox2)
self._panel1.Controls.Add(self._groupBox1)
self._panel1.Location = System.Drawing.Point(12, 52)
self._panel1.Name = "panel1"
self._panel1.Size = System.Drawing.Size(616, 370)
self._panel1.TabIndex = 1
#
# groupBox1
#
self._groupBox1.Controls.Add(self._listBox1)
self._groupBox1.Location = System.Drawing.Point(3, 3)
self._groupBox1.Name = "groupBox1"
self._groupBox1.Size = System.Drawing.Size(177, 364)
self._groupBox1.TabIndex = 0
self._groupBox1.TabStop = False
self._groupBox1.Text = "Lista de palabras"
#
# listBox1
#
self._listBox1.FormattingEnabled = True
self._listBox1.Location = System.Drawing.Point(6, 19)
self._listBox1.Name = "listBox1"
self._listBox1.Size = System.Drawing.Size(165, 342)
self._listBox1.Sorted = True
self._listBox1.TabIndex = 0
self._listBox1.SelectedIndexChanged += self.ListBox1SelectedIndexChanged
#
# groupBox2
#
self._groupBox2.Controls.Add(self._button1)
self._groupBox2.Controls.Add(self._label2)
self._groupBox2.Controls.Add(self._textBox1)
self._groupBox2.Location = System.Drawing.Point(186, 3)
self._groupBox2.Name = "groupBox2"
self._groupBox2.Size = System.Drawing.Size(427, 43)
self._groupBox2.TabIndex = 1
self._groupBox2.TabStop = False
#
# textBox1
#
self._textBox1.Location = System.Drawing.Point(146, 15)
self._textBox1.Name = "textBox1"
self._textBox1.Size = System.Drawing.Size(180, 20)
self._textBox1.TabIndex = 0
#
# label2
#
self._label2.Location = System.Drawing.Point(7, 15)
self._label2.Name = "label2"
self._label2.Size = System.Drawing.Size(133, 23)
self._label2.TabIndex = 1
self._label2.Text = "Escribe palabra a buscar:"
#
# button1
#
self._button1.Location = System.Drawing.Point(334, 13)
self._button1.Name = "button1"
self._button1.Size = System.Drawing.Size(75, 23)
self._button1.TabIndex = 2
self._button1.Text = "Buscar"
self._button1.UseVisualStyleBackColor = True
#
# groupBox3
#
self._groupBox3.Controls.Add(self._button5)
self._groupBox3.Controls.Add(self._button4)
self._groupBox3.Controls.Add(self._button3)
self._groupBox3.Controls.Add(self._button2)
self._groupBox3.Controls.Add(self._label4)
self._groupBox3.Controls.Add(self._textBox3)
self._groupBox3.Controls.Add(self._textBox2)
self._groupBox3.Controls.Add(self._label3)
self._groupBox3.Location = System.Drawing.Point(186, 53)
self._groupBox3.Name = "groupBox3"
self._groupBox3.Size = System.Drawing.Size(427, 314)
self._groupBox3.TabIndex = 2
self._groupBox3.TabStop = False
#
# label3
#
self._label3.Location = System.Drawing.Point(7, 18)
self._label3.Name = "label3"
self._label3.Size = System.Drawing.Size(120, 23)
self._label3.TabIndex = 0
self._label3.Text = "Nombre de palabra:"
#
# textBox2
#
self._textBox2.Location = System.Drawing.Point(115, 18)
self._textBox2.Name = "textBox2"
self._textBox2.ReadOnly = True
self._textBox2.Size = System.Drawing.Size(180, 20)
self._textBox2.TabIndex = 1
#
# textBox3
#
self._textBox3.Location = System.Drawing.Point(7, 59)
self._textBox3.Multiline = True
self._textBox3.Name = "textBox3"
self._textBox3.ReadOnly = True
self._textBox3.Size = System.Drawing.Size(402, 176)
self._textBox3.TabIndex = 2
#
# label4
#
self._label4.Location = System.Drawing.Point(7, 43)
self._label4.Name = "label4"
self._label4.Size = System.Drawing.Size(100, 13)
self._label4.TabIndex = 3
self._label4.Text = "Definición:"
#
# button2
#
self._button2.Location = System.Drawing.Point(7, 241)
self._button2.Name = "button2"
self._button2.Size = System.Drawing.Size(77, 66)
self._button2.TabIndex = 4
self._button2.Text = "Crear nuevo"
self._button2.UseVisualStyleBackColor = True
self._button2.Click += self.Button2Click
#
# button3
#
self._button3.Location = System.Drawing.Point(90, 241)
self._button3.Name = "button3"
self._button3.Size = System.Drawing.Size(77, 66)
self._button3.TabIndex = 5
self._button3.Text = "Editar"
self._button3.UseVisualStyleBackColor = True
#
# button4
#
self._button4.Location = System.Drawing.Point(318, 241)
self._button4.Name = "button4"
self._button4.Size = System.Drawing.Size(91, 66)
self._button4.TabIndex = 6
self._button4.Text = "Eliminar"
self._button4.UseVisualStyleBackColor = True
#
# button5
#
self._button5.Location = System.Drawing.Point(173, 241)
self._button5.Name = "button5"
self._button5.Size = System.Drawing.Size(77, 66)
self._button5.TabIndex = 7
self._button5.Text = "Guardar"
self._button5.UseVisualStyleBackColor = True
self._button5.Click += self.Button5Click
#
# MainForm
#
self.ClientSize = System.Drawing.Size(640, 434)
self.Controls.Add(self._panel1)
self.Controls.Add(self._label1)
self.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWind ow
self.Name = "MainForm"
self.Text = "Diccionario de Programación"
self.Load += self.MainFormLoad
self._panel1.ResumeLayout(False)
self._groupBox1.ResumeLayout(False)
self._groupBox2.ResumeLayout(False)
self._groupBox2.PerformLayout()
self._groupBox3.ResumeLayout(False)
self._groupBox3.PerformLayout()
self.ResumeLayout(False)
def Label1Click(self, sender, e):
pass
def ListBox1SelectedIndexChanged(self, sender, e):
pass
def Button2Click(self, sender, e):
pass
def Button5Click(self, sender, e):
pass
def MainFormLoad(self, sender, e):
pass con la clase palabra; Cita: class Palabra:
def __init__(self,id,palabra,definicion):
self.id = id
self.palabra = palabra
self.definicion = definicion
def getId(self):
return self.id
def getPalabra(self):
return self.palabra
def getDefinicion(self):
return self.definicion
def setId(self, id):
self.id = id
def setPalabra(self):
self.palabra = palabra
def setDefinicion(self):
self.definicion = definicion
Última edición por diegonava0; 16/05/2014 a las 16:11 |