【问题标题】:How to add a window in wxpython other then parent frame and use information in sqlite query如何在 wxpython 中添加除父框架之外的窗口并在 sqlite 查询中使用信息
【发布时间】:2017-11-29 04:24:59
【问题描述】:
我的父框架中有一个按钮(名为“添加”)。当用户单击该按钮时,我想打开一个 TextEntryDialog,我想像弹出窗口一样打开它。我必须将用户键入的文本发送回父框架,我将把它插入到我的数据库表中。如果我可以制作一个可编辑的 listctrl 会更好,其中我将有 4 列,用户将信息填充到这些列中,并通过 sqlite 查询我将这些信息填充到数据库表中。那么我该如何实现呢?
【问题讨论】:
标签:
sqlite
user-interface
dialog
wxpython
frame
【解决方案1】:
第一个教程在第一页搜索“wxpython文本对话框”
https://pythonspot.com/en/wxpython-input-dialog/
你似乎没有付出任何努力!
#!/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()