I need a custom dialog. I've been playing around for hours trying to create one and simply don't get it!
All I need is the standard wx.TextEntryDialog but with 2 text fields. Can anyone please help?
Thanks.

2 text fields requires 2 Entry (Dialogs). Although TextCtrl is generally used. A standard example for entering user name and password.

import wx

class TextFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Text Entry Example', size=(300, 100))
        panel = wx.Panel(self, -1) 
        basicLabel = wx.StaticText(panel, -1, "Basic Control:")
        basicText = wx.TextCtrl(panel, -1, "I've entered some text!", size=(175, -1))
        basicText.SetInsertionPoint(0)

        pwdLabel = wx.StaticText(panel, -1, "Password:")
        pwdText = wx.TextCtrl(panel, -1, "password", size=(175, -1),style=wx.TE_PASSWORD)
        sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
        sizer.AddMany([basicLabel, basicText, pwdLabel, pwdText])
        panel.SetSizer(sizer)

app = wx.PySimpleApp()
frame = TextFrame()
frame.Show()
app.MainLoop()

Edited 4 Years Ago by woooee: n/a

I have created a similar frame as a child window with text boxes but I don't understand how to get the information from this to the main program, hence the question about modifying, so I can see whats going on and try to expand on it.

I have a large paragraph of text and the user has to pick two elements from it. I can do it with a standard textentrydialog for just one element:

dlg = wx.TextEntryDialog(self, paragraph,'Please choose an element...')
        dlg.SetValue("cobalt")

Until now I've had a second textentrydialog open immediately after the first but it is ugly!

Edited 4 Years Ago by floatingshed: n/a

I'm sorry to sound ungrateful but from the questions I'm asking it must be clear that I am an absolute beginner. So, single line questions to my questions, phrased in the style of Yoda are not going to ease my torment.

This article has been dead for over six months. Start a new discussion instead.