Search code examples
sqliteuser-interfacedialogwxpythonframe

How to add a window in wxpython other then parent frame and use information in sqlite query


I have a button in my parent frame(named as Add). I want to open a TextEntryDialog when user clicks that button,I want to open it like a pop up window.And i have to send that text typed by user back to parent frame, which i am going insert into my database table. It would be better if i can make a editable listctrl, in which i will have 4 columns and user will fill information into those columns and by sqlite query i will fill that information into database table.So how can i accomplish this?


Solution

  • First tutorial on the first page of a search for "wxpython text dialog"

    https://pythonspot.com/en/wxpython-input-dialog/
    You don't appear to have put in any effort whatsoever!

    #!/usr/bin/python
    
    import wx
    
    def onButton(event):
        print "Button pressed."
    
    app = wx.App()
    
    frame = wx.Frame(None, -1, 'win.py')
    frame.SetDimensions(0,0,200,50)
    
    # Create text input
    dlg = wx.TextEntryDialog(frame, 'Enter some text','Text Entry')
    dlg.SetValue("Default")
    if dlg.ShowModal() == wx.ID_OK:
        print('You entered: %s\n' % dlg.GetValue())
    dlg.Destroy()