after importing pygame, when we convert an image an assign it to a variable, what is the type of that variable?

Add

print(type(variable))
# this can be useful too
print(variable.__class__)

there is also

import inspect
print(inspect.getmro(variable.__class__))

to get the ancestor classes.

thank u . it said it's a 'pygame.surface' type.could you help me break my python game into funcctions.i use c++ but for my semester project i chose to use python.now i'm havin difficulty in modularizing it.although it works fine without the use of functions. but it looks too jumbled up...

This link tells you quite a lot about the pygame.Surface type, although the most important part is probably out of the class: the set of functions which use the pygame.Surface as a parameter.

If you're used to C++, you will find that it is much easier to write functions in python because python does not complain about the types. I suggest that you take a long piece of code and you try to break it into smaller logical parts, and you write a function for each of these subparts.

yes.i'll try. but trying to convert a non modular to a modular one is getting a little tedious.

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.