🎧 Build a Modern FM Radio App in Python GUI | FuzzuTech Projects

 Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡


















πŸ’‘ Features:

  • Full source code with folder structure

  • GUI tutorial using Tkinter

  • Includes 5 streaming radio stations

  • Stylish dark mode interface

  • Explanation of ffplay usage

  • Embedded YouTube Shorts for cross-traffic


Code :


import tkinter as tk

from tkinter import ttk

import subprocess

import psutil

import os


# FM Stations

FM_STATIONS = {

    "🎡 Radio Paradise": "http://stream.radioparadise.com/mp3-192",

    "🎢 BBC Radio 1": "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p",

    "🎧 181.FM The Beat": "http://listen.181fm.com/181-beat_128k.mp3",

    "🎸 Rock Radio": "http://streaming.radionomy.com/rockradio1",

    "πŸ’– Love Songs Radio": "https://cast1.torontocast.com:2210/stream",

}


class FMRadioApp:

    def __init__(self, root):

        self.root = root

        self.root.title("🎧 FuzzuTech FM Radio")

        self.root.geometry("500x400")

        self.root.configure(bg="#121212")


        self.selected_station = tk.StringVar()

        self.selected_station.set(list(FM_STATIONS.keys())[0])

        self.player_process = None


        title = tk.Label(root, text="🎧 FuzzuTech FM Radio", font=("Helvetica", 20, "bold"),

                         bg="#121212", fg="#00FF99")

        title.pack(pady=20)


        style = ttk.Style()

        style.theme_use("clam")

        style.configure("TCombobox", fieldbackground="#333333", background="#444444", foreground="white")


        self.station_menu = ttk.Combobox(root, values=list(FM_STATIONS.keys()),

                                         textvariable=self.selected_station, font=("Arial", 12), width=35)

        self.station_menu.pack(pady=10)


        play_btn = tk.Button(root, text="▶ Play", command=self.play_radio,

                             font=("Arial", 14), bg="#00CC66", fg="white", width=12)

        play_btn.pack(pady=10)


        stop_btn = tk.Button(root, text="⏹ Stop", command=self.stop_radio,

                             font=("Arial", 14), bg="#CC0033", fg="white", width=12)

        stop_btn.pack(pady=10)


        info = tk.Label(root, text="πŸ“’ FFmpeg required (ffplay)", font=("Arial", 10),

                        bg="#121212", fg="#AAAAAA")

        info.pack(pady=5)


    def play_radio(self):

        self.stop_radio()  # Ensures no duplicate play

        url = FM_STATIONS[self.selected_station.get()]

        self.player_process = subprocess.Popen(

            ["ffplay", "-nodisp", "-autoexit", "-loglevel", "quiet", url],

            stdout=subprocess.DEVNULL,

            stderr=subprocess.DEVNULL

        )


    def stop_radio(self):

        if self.player_process and self.player_process.poll() is None:

            try:

                # Kill child processes properly

                parent = psutil.Process(self.player_process.pid)

                for child in parent.children(recursive=True):

                    child.kill()

                parent.kill()

            except Exception as e:

                print("Error stopping process:", e)

            finally:

                self.player_process = None


if __name__ == "__main__":

    root = tk.Tk()

    app = FMRadioApp(root)

    root.mainloop()

Comments

Popular posts from this blog

Is This News Real or Fake? πŸ€– AI Exposes the Truth | FuzzuTech Python App Demo

🚨 Python Intrusion Detection System (IDS) – Real-Time ML + Tkinter GUI Project | FuzzuTech

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±