1 Replies - 621 Views - Last Post: 25 March 2013 - 09:04 AM Rate Topic: -----

#1 NoRemorse  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 26-January 11

wxPython MessageDialog initialising

Posted 24 March 2013 - 06:36 AM

So, everything is supposed to be simple, I made bold where I get the roblem. I have made a button and binded it to a fuction, which is supposed to initialise a MessageDialog, but nothing happens. Can anyone help?

import wx 

def getInfo(): 
        target = "Tunnid.txt" 
        fail = open(target, "r") 
        readFailist = fail.readlines() 
        return readFailist 

class aken(wx.Frame): 

        global nadalad 

        def __init__(self,parent,id): 

                global nadalad 
                
                wx.Frame.__init__(self, parent, id,'Study tracker',size = (600,300)) 
                panel = wx.Panel(self) 
                panel.SetBackgroundColour('Black') 
                self.Bind(wx.EVT_CLOSE, self.closeWindow) 

                button = wx.Button(panel,label = 'ADD', pos=(350,175),size=(120,65)) 
                self.Bind(wx.EVT_BUTTON, self.lisaMinutid, button)
                
                nadalad = getInfo()                                     
                cunt=wx.ListBox(panel, -1, (10, 10), (290,290), nadalad,wx.LB_SINGLE) 
                cunt.SetSelection(2) 


                self.spinner1 = wx.SpinCtrl(panel, -1, "",(475,30),(90,-1)) 
                self.spinner1.SetRange(1,30) 
                self.spinner1.SetValue(18) 

                custom = wx.StaticText(panel, -1, 'WEEK:',(400,33)) 
                custom.SetForegroundColour('Green') 

                self.spinner2 = wx.SpinCtrl(panel, -1, "",(475, 75),(90,-1)) 
                self.spinner2.SetRange(1,400) 
                self.spinner2.SetValue(60) 

                custom2 = wx.StaticText(panel, -1, 'MINUTES:',(400,78)) 
                custom2.SetForegroundColour('Green') 


        def closeWindow(self,event): 
                self.Destroy() 

        def lisaMinutid(self,event): 
                added = wx.MessageDialog(None, 'Minutes added.','',wx.OK) 
                added.Destroy()
                value = self.spinner2.GetValue() 
                week = self.spinner1.GetValue() 
                newValue = int(nadalad[week - 1][10:]) + value 
                nadalad[week - 1] = '%d. nadal: %d' %(week, newValue) 
                target = 'Tunnid.txt' 
                fail = open(target, "w") 
                for week in nadalad: 
                        fail.write(week) 
                fail.close() 
                
if __name__ == '__main__': 
        app = wx.PySimpleApp() 
        frame = aken(parent=None,id=-1) 
        frame.Show() 
        app.MainLoop()


Is This A Good Question/Topic? 0
  • +

Replies To: wxPython MessageDialog initialising

#2 NoRemorse  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 26-January 11

Re: wxPython MessageDialog initialising

Posted 25 March 2013 - 09:04 AM

bump
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1