am I heading in the right direction?

Nathan smith <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
Hi group,

I have two questions today, both of which are just verification checks 
to make sure, for the most part, I'm doing things right.

1. to do with notifications:

As part of one of my projects I wanted to implement a way to send text 
messages to your fellow gamer, even if its a quick, "you suck why did 
you kill my level 500 beast."

the problem was, I'm not sure how to go about visually showing this. For 
example, for blind users, I'd use something like:

sound=load_sound("new_message.ogg")

sound.play()

speak("You have a new message from "+message.username+" that reads 
"+message.text)


Now, I was looking through the wx python demos and at first, I thought 
NotificationMessage would be a good one, and it does seem useful for 
other stuff I had in mind. I think Skype may use similar as a back end 
if you call someone when they are offline, then they come back online.

That could get very annoying, very fast though I'd imagine. So my next 
idea was to use a wx.listCtrl called chat_history.

Then to have it to where each chat message is appended to the list, and 
coloured red. Once you focus the cursor into the list (read it), it 
turns them the normal, I'm assuming white, colour.

Would this, along with a sound, be a suitable visual way of showing chat 
notifications?


Second off, this one is to do with panels. I'm a little stuck as to how 
I should be showing my panels, and to be honest I think I'm overdoing it 
a lot.

Here's a commented version of a basic window I might use. Any help on 
this would be appreciated.

Thanks again everyone for your patients.

Nathan


code:

def create_window(self):

   panel = wx.Panel(self, wx.ID_ANY, style= wx.WANTS_CHARS) # create the 
panel so it looks correct on all platforms and is easier to manage
   self.mainpanel=panel # store the panel so that you can hide or show 
it later on
   panel.SetBackgroundColour("white") # because otherwise you can't see 
stuff?
   vbox = wx.BoxSizer(wx.VERTICAL)  # puts one sizer above the other I 
think, in a vertical line. I should probably change this to grid, but 
screen visualisation in my head is a bit of a knockout right now
   hbox1 = wx.BoxSizer(wx.HORIZONTAL) # multiples of these would create 
lines of horizontal widgets across the screen, I think.
   self.info1 = wx.ListCtrl(panel, -1, style = wx.LC_REPORT)
   hbox1.Add(self.info1, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   self.info1.InsertColumn(0, "Information.")
   self.info1.SetName("Information.") # screen reader stuff
   self.info1.SetFocus()
   self.info1.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.send_enter) # adding 
items to the list is handled in code not included as it's irrelevant
   browse1 = wx.Button(panel, -1, "Exit!")
   browse1.Bind(wx.EVT_BUTTON, self.endit)
   hbox1.Add(browse1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   vbox.Add(hbox1)
   panel.SetSizer(vbox)
   panel.Show()
   panel.Fit() # assuming it fits it to the screen
   panel.Layout() # not sure entirely, but figure it draws everything on 
screen
   panel.Update() # don't know if I actually need this, I'm a bit 
confused between self.Refresh, and self.upadte
   self.Show() # for the frame
   self.Fit()
   self.Update()
   self.Refresh()
   self.Center()

# I realise some of these calls may be unnecessary, but I'm really unsure

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/f4f1326f-a12c-048d-a251-956a023b3cff%40gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.