Open fujiman3 opened 6 years ago
Hey, sorry to hear you're having some issues.
It's been a while since I played with this code and I never fleshed it out to be functional for much more than the most basic of demos but I'll have a look through the code and see if I can get reacquainted.
I've not got my rpi set up so might have some issues running the code here.
Are you able to post the full error message?
Out of interest, if you comment out everything after import globalsettings in myFunctions.py and replace it with;
def myFunction1(): print("Executing myFunction1") def myFunction2(): print("Executing myFunction2") functionHandlersDictionary = { "myFunction1": [myFunction1, "My function 1"], "myFunction2": [myFunction2, "My Function 2"]}
Does that work?
Here's the full traceback: Button 2 handler ('selecting menu screen ', 998) Call to menu function handler ('Looking for match for ', 'myFunction1')
addendum:
The print output line seems to have vanished from my post, just after ('Looking for ....... ) it should have a line that says "
I'm sorry about this but the text I'm trying to post is being ignored, it should be between the double quotes in the previous comment. I'll put it into a text file instead. errortext.txt
Cheers that's great.
Yes the markup plays havoc with text.
I think it should work if you put < pre ></ pre > tags around the text. (without spaces)
Starting to get my head round the code a little bit now.
Are you able to post the full debug output including the initialisation.
Do you get any debug info about "function handle registered"?
Here is the full initialisation output:
Initialising MenuSystem object Menu Reader class initialized ('Menus will be read from ', 'menus/') ('Processing menu file ', 'menus/menu.0') ('Processing menu file ', 'menus/menu.1') ('Processing menu file ', 'menus/menu.2') ('Processing menu file ', 'menus/menu.3') ('Processing menu file ', 'menus/menu.4') ('Processing menu file ', 'menus/menu.5') ('Processing menu file ', 'menus/menu.6') ('Processing menu file ', 'menus/menu.7') ('Processing menu file ', 'menus/menu.8') ('Processing menu file ', 'menus/menu.9') ('Processing menu file ', 'menus/menu.9a') ('Processing titles file', 'menus/titles.lst') ('Title entered in to list position,', [0, 'Menu System\n']) ('Title entered in to list position,', [1, 'First Screen\n']) ('Title entered in to list position,', [2, 'Second Screen\n']) ('Title entered in to list position,', [3, 'Third Screen\n']) ('Title entered in to list position,', [4, 'Function Handlers\n']) ('Title entered in to list position,', [5, 'Sub Screen 5\n']) ('Title entered in to list position,', [6, 'Sub Screen 6\n']) ('Title entered in to list position,', [7, 'Sub Screen 7\n']) ('Title entered in to list position,', [8, 'Sub Screen 8\n']) ('Title entered in to list position,', [9, 'Sub Screen 9\n']) ('Title entered in to list position,', [10, 'Sub Screen 10\n']) init my menu func ('Processing functions file', 'menus/functions.lst') ('creating dictionary object with key ', ['myFunction1', ['myFunction1', 'myFunction1', 'My Function 1']]) ('self.functions =', {'myFunction1': ('myFunction1', 'My Function 1')}) ('creating dictionary object with key ', ['myFunction2', ['myFunction2', 'myFunction2', 'My Function 2']]) ('self.functions =', {'myFunction1': ('myFunction1', 'My Function 1'), 'myFunction2': ('myFunction2', 'My Function 2')}) Registering functions ('Function handler registered:', 'My Function 1') ('Function handler registered:', 'My Function 2') InputGetter class initialised Drawing titleHope this helps. Many thanks.
Thank you.
Looks like the functions are registering correctly.
I'm looking at line 26 in myClasses.py and wondering if that shouldn't be commented out?
Sorry for the back and forth, wish I could test this here.
What happens if you remove the comment from that line.
self.functionHandlersDictionary = functionHandlersDictionary
Commented that line out but still get the same error message :-( Unbound method myFunction1() .........
Argh ok.
Thanks for trying that.
I'll see if I can dig the pi out later in the week and give it a run on that to see if I can work out what's going on.
Thank you, I really appreciate your efforts on this. When I finally publish my project online (hackaday and instructables) I will ensure that all acknowledgements for the menu system go to you.
On Tue, 9 Oct 2018, 10:44 John Porter, notifications@github.com wrote:
Argh ok.
Thanks for trying that.
I'll see if I can dig the pi out later in the week and give it a run on that to see if I can work out what's going on.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jpuk/rpi-128x64-oled-menusystem/issues/1#issuecomment-428129338, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap5k0ym2aRYjUmwZ0DLKhqa0-0uaXAyDks5ujHAAgaJpZM4XMaQ0 .
I ran the menusystem on a Raspberry Pi Zero, menu shows correctly, selected "help" then "function1" got the following error. TypeError: unbound method myFunction1() must be called with MenuFunc_Base instan ce as first argument (got nothing instead).
What I've changed: - on my local files. The pin numbers for the buttons. Added pull down option in the button setup section, the pins on my Pi were constantly high (insert joke here). Uncommented functionHandlersDictionary in myfunctions.py - I was getting a global variable error.
My knowledge of Python is limited. Any guidance will be much appreciated.