Feb-20-2018, 09:20 PM
Thanks for the help I am beginning to get a bit more of a grip on it now.
I have been playing around with some of the demos but I find that if I have some specific project in mind I find it easier.
Now I have an elderly friend who is blind. Before that happened she loved to read her Bible so I thought I would see what I might be able to do to help her. I have downloaded a copy in mp3 format. It is a whole series of files each of which is one chapter so I have started to work out if I can get it set up for her.
My current plan is to have a set of buttons each of which represents a book. Then clicking on one will show a frame which has buttons on it and each one when clicked will play the file that relates to that chapter.
So she can navigate I want to play another mp3 which I will record announcing the book or chapter when the mouse enters the button. This is what I have so far ( I know it's probably a poor way of doing it )
I am using a script from here
which I have been modifying
Problem is that the OnButton click event is detected and works but the OnEnterWindow doesn't.
So once again I am stuck.Can you spot the way to fix my problem please?
I have been playing around with some of the demos but I find that if I have some specific project in mind I find it easier.
Now I have an elderly friend who is blind. Before that happened she loved to read her Bible so I thought I would see what I might be able to do to help her. I have downloaded a copy in mp3 format. It is a whole series of files each of which is one chapter so I have started to work out if I can get it set up for her.
My current plan is to have a set of buttons each of which represents a book. Then clicking on one will show a frame which has buttons on it and each one when clicked will play the file that relates to that chapter.
So she can navigate I want to play another mp3 which I will record announcing the book or chapter when the mouse enters the button. This is what I have so far ( I know it's probably a poor way of doing it )
I am using a script from here
http://www.java2s.com/Tutorial/Python/0380__wxPython/BindeventtobuttonMouseenterandleavebuttonclicked.htm
which I have been modifying
import wx import wx.lib.buttons as buttons books = [' ','Genesis050', 'Exodus040', 'Leviticus027', 'Numbers036', 'Deuteronomy034', 'Joshua024', 'Judges021', 'Ruth004', '1 Samuel031', '2 Samuel024', '1 Kings022', '2 Kings025', '1 Chronicles029', '2 Chronicles036', 'Ezra010', 'Nehemiah013', 'Esther010', 'Job042', 'Psalms150', 'Proverbs031', 'Ecclesiastes012', 'Song of Solomon008', 'Isaiah066', 'Jeremiah052', 'Lamentations005', 'Ezekiel048', 'Daniel012', 'Hosea014', 'Joel003', 'Amos009', 'Obadiah001', 'Jonah004', 'Micah007', 'Nahum003', 'Habakkuk003', 'Zephaniah003', 'Haggai002', 'Zechariah014', 'Malachi004', 'Matthew028', 'Mark016', 'Luke024', 'John021', 'Acts028', 'Romans016', '1 Corinthians016', '2 Corinthians013', 'Galatians006', 'Ephesians006', 'Philippians004', 'Colossians004', '1 Thessalonians005', '2 Thessalonians003', '1 Timothy006', '2 Timothy004', 'Titus003', 'Philemon001', 'Hebrews013', 'James005', '1 Peter005', '2 Peter003', '1 John005', '2 John001', '3 John001', 'Jude001', 'Revelation022'] global row, column row = 0 column = 0 class MouseEventFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame and Button', size=(1210, 400)) # wx.Frame.__init__(self, parent, id, size=(1210, 400)) self.panel = wx.Panel(self) row = 0 column = 0 for x in range(1,67): txt = books[x] myname = txt[:-3] while (len(myname) < 15): myname = " " + myname while (len(myname) < 20): myname += " " btn = 'butt' + str(x) btn = wx.Button(self.panel, -1, myname, pos=(column, row ) )#50, 50)) myname self.Bind(wx.EVT_BUTTON, self.OnButton,btn) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow,btn) column += 120 if column == 1200: column = 0 row += 55 def OnButton(self, event): obj = event.GetEventObject() print("You clicked %s\n"%obj.GetLabel()) event.Skip() def OnEnterWindow(self, event): self.button.SetMyname("Over Me!") event.Skip() app = wx.App() frame = MouseEventFrame(parent=None, id=-1) #frame = MyFrame(None, 'wx.lib.buttons Test') frame.Show() app.MainLoop()It's obviously at an early stage so far and I am developing it on my Linux machine but she has WIn7 Pro so no doubt it will need some changes. The 3 digits at the end of each name are how many chapters there are in the book
Problem is that the OnButton click event is detected and works but the OnEnterWindow doesn't.
So once again I am stuck.Can you spot the way to fix my problem please?