#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0

    Changing the font color orbg color


    import random

    myn=random.randrange(3)+1
    print myn
    if myn==2:
    print "hello world" # I want this text to be "red"
    #how can we change the background color if rondon number is say 3?
    # Thanks
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,900
    Rep Power
    481
    You either run the program as a gui, maybe with tkinter,
    or use a terminal that recognizes ANSI sequences. and maybe you could use the curses or ncurses module to help with this.

    Comments on this post

    • heybel34 agrees : thanks
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0
    Thank you..
    It seems that you are the only one to reply my posts.
    I suppose I will have more questions as I am new to Pygame/python.. Hope you be patient enough t o reply them ? will you ?

IMN logo majestic logo threadwatch logo seochat tools logo