While looking stuff about idlelib, I came to this thread in stackoverflow, so I posted own solution. I post it also here, as maybe somebody needs it (as for example \b looks ugly in IDLE)
Checking if program is run in IDLE
import sys
print('Running IDLE' if 'idlelib.run' in sys.modules else 'Out of IDLE')
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.