I've been learning python and I'm almost finished and I'm learning about oop. I have a question, is it possible to make a looping menu using oop on python (Not using Tkinter, WX) without having to key in the object. I learn better through playing around with what I've learned after I finished a lesson.
Onion13
31
Junior Poster in Training
Recommended Answers
Jump to PostHow do you expect the looping menu to work ? Can you describe its behavior ?
Jump to PostYou could start an OOP menu system like this for example
#!/usr/bin/env python # -*-coding: utf8-*- '''doc ''' from __future__ import (absolute_import, division, print_function, unicode_literals) class Choice(object): def __init__(self, desc): self.desc = desc def on_selection(self, menu, index): print("'{}' was selected".format(self.desc)) return self class ExitChoice(Choice): def on_selection(self, menu, …
Jump to PostIf
mainMenu
is a list, the expressionmainMenu()
does not make sense becausemainMenu
is not a function (it is notcallable
in python's terminology). The same holds formenua
,menub
etc.
Jump to PostI don't understand your program. The first thing to do is always to solve the error messages sent by the python interpreter itself. Can you post the current state of your program, if it executes without error ?
Jump to PostYou are writing classes, but the program doesn't do anything besides defining those classes. It doesn't make much sense.
All 18 Replies
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Onion13
31
Junior Poster in Training
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Onion13
31
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.