• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Taking Input in Python

phokur

n00b
Joined
Sep 3, 2007
Messages
44
I'm trying to make a winamp station selector in Python and it's working, I just don't like having to hit enter after each selection. Is there any way to do that in Python?
Code:
# Needs to be in winamp folder

while True:
  import os

  def X(): print os.system('winamp.exe http://sc12.1.fm:7024')
  def HighVoltage(): print os.system('winamp.exe http://sc12.1.fm:7058')
  def Trance(): print os.system('winamp.exe http://sc8.1.fm:7012')
  def errhandler (): print ""

  takeaction = {
    "1": X,
    "2": HighVoltage,
    "3": Trance}

  station = raw_input("Please enter a station: ")
  takeaction.get(station,errhandler)()
 
Figured it out used msvcrt:
Code:
# Needs to be in winamp folder
import os
import msvcrt

while 1:
    char = msvcrt.getch()
    if char == chr(27):
        break
    if char == chr(49):
        print os.system('winamp.exe http://sc12.1.fm:7024')
    if char == chr(50):
        print os.system('winamp.exe http://sc12.1.fm:7058')
    if char == chr(51):
        print os.system('winamp.exe http://sc8.1.fm:7012')
 
Back
Top