Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- import os
- conn = sqlite3.connect('KHAMAN.db')
- c = conn.cursor()
- class Example(wx.Frame):
- def __init__(self, parent, title):
- super(Example, self).__init__(parent, title=title, size=(1000,800))
- self.inter_list = list()
- self.plot_list = list()
- self.InitUI()
- self.Layout()
- self.Centre()
- self.Show()
- def InitUI(self):
- self.p = wx.Panel(self)
- bs = wx.BoxSizer(wx.VERTICAL)
- gs = wx.GridSizer(10, 18, 5, 5)
- bs.Add(gs, 1, wx.EXPAND)
- self.search_btn=wx.Button(self.p,-1,"Search!")
- self.search_btn.Bind(wx.EVT_BUTTON, self.OnSearch, self.search_btn)
- bs.Add(self.search_btn,0,wx.ALIGN_CENTER)
- self.p.SetSizer(bs)
- def OnSearch(self, event):
- dlg = GetData(parent = self.p)
- dlg.ShowModal()
- if dlg.result_name:
- print "Elements: "+dlg.result_elements+"\n"
- print "Name: "+dlg.result_name+"\n"
- print "Formula: "+dlg.result_formula+"\n"
- else:
- print "No Input found\n"
- dlg.Destroy()
- class GetData(wx.Dialog):
- def __init__(self, parent):
- wx.Dialog.__init__(self, parent, wx.ID_ANY, "New Molecule", size= (650,220))
- self.p = wx.Panel(self,wx.ID_ANY)
- self.lblelements = wx.StaticText(self.p, label="Elements", pos=(20,20))
- self.elements = wx.TextCtrl(self.p, value="", pos=(110,20), size=(500,-1))
- self.lblnam = wx.StaticText(self.p, label="Name", pos=(20,60))
- self.name = wx.TextCtrl(self.p, value="", pos=(110,60), size=(500,-1))
- self.lblform = wx.StaticText(self.p, label="Formula", pos=(20,100))
- self.formula = wx.TextCtrl(self.p, value="", pos=(110,100), size=(500,-1))
- self.saveButton =wx.Button(self.p, label="Save", pos=(110,170))
- self.closeButton =wx.Button(self.p, label="Cancel", pos=(210,170))
- self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
- self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
- self.Bind(wx.EVT_CLOSE, self.OnQuit)
- self.Show()
- def OnQuit(self, event):
- self.result_number = None
- self.Destroy()
- def SaveConnString(self, event):
- self.result_elements = self.elements.GetValue()
- self.result_name = self.name.GetValue()
- self.result_formula = self.formula.GetValue()
- self.Destroy()
- app = wx.App()
- Example(None, title = 'Raman Spectroscopy Database')
- app.MainLoop()
Add Comment
Please, Sign In to add comment