import wxversion
wxversion.select('2.8')
import wx
class build (wx.Frame):
def __init__ (self,parent,id):
wx.Frame.__init__(self,parent,id,"Dictionary", size= (700,500))
panel = wx.Panel(self)
pic = wx.Image('C:/Users/bob/Desktop/programs/python/Search Dictionary.bmp', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.button=wx.BitmapButton(panel, -1, pic, pos=(180,10))
self.Bind (wx.EVT_BUTTON, self.SearchDictionary, self.button)
self.button.SetDefault()
def SearchDictionary(self, event):
box = wx.TextEntryDialog(None,"What's the word you wish to look up? (Lower-Case)", "Dictionary", "")
if box.ShowModal() == wx.ID_OK:
answer = box.GetValue
if answer() == "1":
wx.StaticText(self, -1, "Example Text 1 ", (30,100))
if answer() == "2":
wx.StaticText(self,-1,"Example Text 2 ", (30,100))
def closewindow(self, event):
self.Destroy()
if __name__=="__main__":
app=wx.PySimpleApp()
frame=build(parent=None,id=-1)
frame.Show()
app.MainLoop()
So at the moment it creates a frame with a bitmap button on it and when you press it, it brings up a wx.TextEntryDialog window. Then when you choose your word it saves it and prints out the certain wx.StaticText that i have specially written to that word. What I want to do though is get rid of the bitmap button completely and have the dialog box in the frame instead of a separate window, like how Google have there website.

New Topic/Question
Reply



MultiQuote




|