How to create a pop-up menu to get numerical input
You can create an operator which will show a menu when called , this is the Simple Operator example edited to fit this case :




Run the script to rigster the operator
press Space and type Simple Object Operator




import bpy
from bpy.props import IntProperty

def main(self, context):
    bpy.ops.object.subdivision_set(level=self.level)

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER', 'UNDO'}

    level = IntProperty(default = 1, min = 0, max = 10)

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        main(self, context)
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)

def register():
    bpy.utils.register_class(SimpleOperator)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    register()