HACKERS ELITE
Bienvenido a HACKERS ELITE
porfavor registrate o inicia secion para ver todo el contenido del foro, disfruta tu visita!
Últimos temas
» Me bloquearon mi celular para conectarse a la Red Wifi en Modo Avion
Vie Sep 05, 2014 6:15 pm por JAVIER_77

» Hacker nostale
Vie Jul 20, 2012 5:02 pm por Sweet_Boy

» Chrome OS 20.x pasa al canal estable
Vie Jul 13, 2012 11:15 pm por [D]ement<<<

» Disponible openSUSE 12.2 RC 1
Vie Jul 13, 2012 12:44 am por [D]ement<<<

» NitroShare, comparte archivos y carpetas entre Linux y Windows
Vie Jul 13, 2012 12:26 am por [D]ement<<<

» Linux Mint 13 KDE Release Candidate, disponible
Vie Jul 13, 2012 12:18 am por [D]ement<<<

» LibreOffice 3.5.5, más estabilidad
Vie Jul 13, 2012 12:06 am por [D]ement<<<

» File History, un Time Machine para Windows 8
Miér Jul 11, 2012 9:50 pm por [D]ement<<<

» Como habilitar el logueo automático en Windows
Miér Jul 11, 2012 9:44 pm por [D]ement<<<

» Acronis True Image 2012
Mar Jul 10, 2012 12:15 am por [D]ement<<<

» Virus Informaticos
Mar Mayo 08, 2012 7:10 am por Sokoleonardo

Buscar
 
 

Resultados por:
 


Rechercher Búsqueda avanzada

Septiembre 2017
LunMarMiérJueVieSábDom
    123
45678910
11121314151617
18192021222324
252627282930 

Calendario Calendario


[Tk] MP3 Play music

Ver el tema anterior Ver el tema siguiente Ir abajo

[Tk] MP3 Play music

Mensaje por Sokoleonardo el Sáb Nov 12, 2011 2:30 pm

Echo en Python (Con el modulo Tk Para interfaz grafica)

[Tienes que estar registrado y conectado para ver esa imagen]

Código:

#!usr/bin/python
# -*- coding: utf-8 -*-
import tkFileDialog,tkMessageBox,os,cPickle,platform
from Tkinter import *
try:
    import audiere
except ImportError:
    import audiere #if not numpy multi array

def EXIT():
    window.destroy()
    quit()
def CONTINUE():
    window.destroy()
   
window = Tk()
window.resizable(0,0)
window.title("initiate")
icon = "icono.ico" if (platform.system() == "Windows") else "icono.png"
try:
    window.iconbitmap(icon)
except:
    print 'Not name','"'+icon+'"', 'in directory, size 32x32'
SubTitle = Label(window,text="Initiate MP3 Play Music\n"+"\\"*15).place(x=44,y=20)
button1 = Button(window,text="go!",height=2,width=7,command=CONTINUE)
button1.place(x=20,y=140)
button2 = Button(window,text="quit",height=2,width=7,command=EXIT)
button2.place(x=130,y=140)
window.mainloop()

#-Configurations-

if not os.path.exists("Config.MPlayM"):
    File = file("Config.MPlayM","w")
    defaults = ["black",False]
    cPickle.dump(defaults,File,2)
    File.close()

class ConfigureMP3PlayMusic:
    def __init__(self):
        self.window = Tk()
        self.window.tk_setPalette("gray14")
        self.window.title("Configure")
        self.window.resizable(0,0)
        icon = "icono.ico" if (platform.system() == "Windows") else "icono.png"
        try:
            self.window.iconbitmap(icon)
        except:
            print 'Not name','"'+icon+'"', 'in directory, size 32x32'
        Config = cPickle.load(file("Config.MPlayM","r"))
        self.configuration = {"color":Config[0],"autosave":Config[1]}
        self.mark1 = Label(self.window,text="Configure MP3 play music")
        self.mark1.place(x=30,y=0)
        self.mark2 = Label(self.window,padx=75,pady=70,relief="groove")
        self.mark2.place(x=23,y=85)
        self.text = Label(self.window,text="Colors Look")
        self.text.place(x=73,y=90)
        self.checkAutoSave = Checkbutton(self.window,text="Autosave list tracks?",padx=10,pady=10,relief="groove",command=self.DeselectsCall0)
        self.checkAutoSave.place(x=26,y=35)
        self.checkColorBlack = Checkbutton(self.window,fg="black",text="Original",activeforeground="green",command=self.DeselectsCall1)
        self.checkColorBlack.place(x=26,y=115)
        self.checkViolet = Checkbutton(self.window,fg="MediumOrchid4",text="Violet",activeforeground="green",command=self.DeselectsCall2)
        self.checkViolet.place(x=26,y=135)
        self.checkMaroon = Checkbutton(self.window,fg="burlywood4",text="Maroon",activeforeground="green",command=self.DeselectsCall3)
        self.checkMaroon.place(x=105,y=115)
        self.checkCelestial = Checkbutton(self.window,fg="SystemHighlight",text="Celestial",activeforeground="green",command=self.DeselectsCall4)
        self.checkCelestial.place(x=105,y=135)
        self.checkOrange = Checkbutton(self.window,fg="orange",text="Orange",activeforeground="green",command=self.DeselectsCall5)
        self.checkOrange.place(x=105,y=155)
        self.checkBlue = Checkbutton(self.window,fg="#000080",text="Blue",activeforeground="green",command=self.DeselectsCall6)
        self.checkBlue.place(x=26,y=155)
        self.checkGold = Checkbutton(self.window,fg="#908000",text="Gold",activeforeground="green",command=self.DeselectsCall7)
        self.checkGold.place(x=26,y=175)
        self.checkGreen = Checkbutton(self.window,fg="#008080",text="Green",activeforeground="green",command=self.DeselectsCall8)
        self.checkGreen.place(x=26,y=195)
        self.checkGray = Checkbutton(self.window,fg="gray40",text="Gray",activeforeground="green",command=self.DeselectsCall9)
        self.checkGray.place(x=26,y=215)
        self.checkYellow = Checkbutton(self.window,fg="yellow",text="Yellow",activeforeground="green",command=self.DeselectsCall10)
        self.checkYellow.place(x=105,y=175)
        self.checkWinSys = Checkbutton(self.window,fg="#C0C0C0",text="WinSys",activeforeground="green",command=self.DeselectsCall11)
        self.checkWinSys.place(x=105,y=195)
        self.checkSalmon = Checkbutton(self.window,fg="salmon",text="Salmon",activeforeground="green",command=self.DeselectsCall12)
        self.checkSalmon.place(x=105,y=215)
        self.colors = ("red" , "blue" , "green" , "yellow" , "gray" , "black" , "orange" , "violet" , "pink")
        self.window.minsize(100,280)
        self.ButtonCancel = Button(self.window,text="Cancel",height=2,width=6,overrelief="groove",command=self.Cancel)
        self.ButtonCancel.place(x=110,y=242)
        self.ButtonAcept = Button(self.window,text="Apply",height=2,width=6,overrelief="groove",state="disabled",command=self.ApplyTo)
        self.ButtonAcept.place(x=45,y=242)
        # - Load state butons -
        if Config[0] == "black":
            self.checkColorBlack.select()
        elif Config[0] == "MediumOrchid4":
            self.checkViolet.select()
        elif Config[0] == "burlywood4":
            self.checkMaroon.select()
        elif Config[0] == "SystemHighlight":
            self.checkCelestial.select()
        elif Config[0] == "orange":
            self.checkOrange.select()
        elif Config[0] == "#000080":
            self.checkBlue.select()
        elif Config[0] == "#908000":
            self.checkGold.select()
        elif Config[0] == "#008080":
            self.checkGreen.select()
        elif Config[0] == "gray40":
            self.checkGray.select()
        elif Config[0] == "yellow":
            self.checkYellow.select()
        elif Config[0] == "#C0C0C0":
            self.checkWinSys.select()
        elif Config[0] == "salmon":
            self.checkSalmon.select()
        if Config[1]: self.checkAutoSave.select()

    def CheckStateButtonDecide(self):
        comparable = self.configuration.values()
        if comparable  == cPickle.load(file("Config.MPlayM","r")):
            self.ButtonAcept["state"] = "disable"
        else:
            self.ButtonAcept["state"] = "normal"
           
    def ApplyTo(self):
        Configs = self.configuration
        File = file("Config.MPlayM","w")
        Changes = [Configs["color"],Configs["autosave"]]
        cPickle.dump(Changes,File,2)
        File.close()
        Config = cPickle.load(file("Config.MPlayM","r"))[0]
        MyMusic.window.tk_setPalette(Config)

    def Cancel(self):
        File = file("Config.MPlayM","r")
        Config = cPickle.load(File)
        self.configuration["color"] = Config[0]
        self.configuration["autosave"] = Config[1]
        File.close()
        self.window.destroy()
       
    def ConfigureProgram(self,Type=None,Color=None):
        if Type == "COLOR":
            if Color == "Black":
                self.configuration["color"] = "black"
            elif Color == "Violet":
                self.configuration["color"] = "MediumOrchid4"
            elif Color == "Maroon":
                self.configuration["color"] = "burlywood4"
            elif Color == "Celestial":
                self.configuration["color"] = "SystemHighlight"
            elif Color == "Blue":
                self.configuration["color"] = "#000080"
            elif Color == "Orange":
                self.configuration["color"] = "orange"
            elif Color == "Gold":
                self.configuration["color"] = "#908000"
            elif Color == "Yellow":
                self.configuration["color"] = "yellow"
            elif Color == "Green":
                self.configuration["color"] = "#008080"
            elif Color == "WinSys":
                self.configuration["color"] = "#C0C0C0"
            elif Color == "Gray":
                self.configuration["color"] = "gray40"
            elif Color == "Salmon":
                self.configuration["color"] = "salmon"
        elif Type == "AUTOSAVE":
            if not self.configuration["autosave"]:
                self.configuration["autosave"] = True
            else:
                self.configuration["autosave"] = False
        self.CheckStateButtonDecide()
           
    def DeselectsAndSelect(self,Type,select=None,color=None):
        Buttons = [self.checkColorBlack,self.checkViolet,self.checkMaroon,self.checkCelestial,
        self.checkOrange,self.checkBlue,self.checkGold,self.checkGreen,self.checkGray,
        self.checkYellow,self.checkWinSys,self.checkSalmon]
        if select in Buttons:
            Buttons.remove(select)
        if select:
            for i in Buttons:
                i.deselect()
        self.ConfigureProgram(Type,color)
    def DeselectsCall0(self):
        self.DeselectsAndSelect("AUTOSAVE")
    def DeselectsCall1(self):
        self.checkColorBlack.select()
        self.DeselectsAndSelect("COLOR",self.checkColorBlack,"Black")
    def DeselectsCall2(self):
        self.checkViolet.select()
        self.DeselectsAndSelect("COLOR",self.checkViolet,"Violet")
    def DeselectsCall3(self):
        self.checkMaroon.select()
        self.DeselectsAndSelect("COLOR",self.checkMaroon,"Maroon")
    def DeselectsCall4(self):
        self.checkCelestial.select()
        self.DeselectsAndSelect("COLOR",self.checkCelestial,"Celestial")
    def DeselectsCall5(self):
        self.checkOrange.select()
        self.DeselectsAndSelect("COLOR",self.checkOrange,"Orange")
    def DeselectsCall6(self):
        self.checkBlue.select()
        self.DeselectsAndSelect("COLOR",self.checkBlue,"Blue")
    def DeselectsCall7(self):
        self.checkGold.select()
        self.DeselectsAndSelect("COLOR",self.checkGold,"Gold")
    def DeselectsCall8(self):
        self.checkGreen.select()
        self.DeselectsAndSelect("COLOR",self.checkGreen,"Green")
    def DeselectsCall9(self):
        self.checkGray.select()
        self.DeselectsAndSelect("COLOR",self.checkGray,"Gray")
    def DeselectsCall10(self):
        self.checkYellow.select()
        self.DeselectsAndSelect("COLOR",self.checkYellow,"Yellow")
    def DeselectsCall11(self):
        self.checkWinSys.select()
        self.DeselectsAndSelect("COLOR",self.checkWinSys,"WinSys")
    def DeselectsCall12(self):
        self.checkSalmon.select()
        self.DeselectsAndSelect("COLOR",self.checkSalmon,"Salmon")


#-End Configurations-

class PlayingMP3:
    def __init__(self):
        w = "white"
        self.window = Tk()
        self.window.title("MP3 play music")
        self.window.minsize(389,310)
        self.window.resizable(0,0)
        self.TrackPresent = 0
        self.Tracks = [None]
        self.NameTrack = []
        self.HelpOnOff = "on"
        self.CopyrightOnOff = "on"
        self.patience = 0
        self.patience2 = 0
        self.patience3 = 0
        self.patience4 = 0
        self.OptionsOnOff = False
        icon = "icono.ico" if (platform.system() == "Windows") else "icono.png"
        try:
            self.window.iconbitmap('icono.ico')
        except:
            print 'Not name','"'+icon+'"', 'in directory, size 32x32'
        self.buton1 = Button(self.window,text="▲",overrelief="groove",width=6,height=4,fg=w,command=self.OpenFiles,cursor="hand2")
        self.buton1.place(x=4,y=4)
        self.buton2 = Button(self.window,text="██",overrelief="groove",width=6,height=4,fg=w,command=self.StopMP3,cursor="hand2")
        self.buton2.place(x=52,y=4)
        self.buton3 = Button(self.window,text="►",overrelief="groove",width=6,height=4,fg=w,command=self.PlayMP3,cursor="hand2")
        self.buton3.place(x=100,y=4)
        self.buton4 = Button(self.window,text="▐▐",overrelief="groove",width=6,height=4,fg=w,command=self.PauseMP3,cursor="hand2")
        self.buton4.place(x=148,y=4)
        self.buton5 = Button(self.window,text="▐◄",overrelief="groove",width=6,height=4,fg=w,command=self.ChangeTrackDown,cursor="hand2")
        self.buton5.place(x=196,y=4)
        self.buton6 = Button(self.window,text="►▌",overrelief="groove",width=6,height=4,fg=w,command=self.ChangeTrackUp,cursor="hand2")
        self.buton6.place(x=244,y=4)
        self.butonLoadRecents = Button(self.window,text="Load recent\ntracks",overrelief="groove",anchor="n",width=10,height=2,fg="#beff9c",command=self.LoadRecentFiles,cursor="hand2",activeforeground="blue")
        self.butonLoadRecents.place(x=317,y=201)
        self.ResetList = Button(self.window,text="Recet list\nof\ntracks",overrelief="groove",anchor="n",width=10,height=3,fg="#beff9c",command=self.RecetListReproductions,cursor="hand2",activeforeground="green")
        self.ResetList.place(x=317,y=240)
        self.titleRepeatCtrl = Label(self.window,text="repeat track?:",fg="#beff9c")
        self.titleRepeatCtrl.place(x=311,y=155)
        self.RepeatOnOff1 = Button(self.window,text=">",overrelief="groove",width=1,height=1,fg="green",command=self.RepeatON,cursor="hand2")
        self.RepeatOnOff1.place(x=364,y=175)
        self.ONOFFtext = Label(self.window,text="ON",fg="green")
        self.ONOFFtext.place(x=333,y=178)
        self.RepeatOnOff2 = Button(self.window,text="<",overrelief="groove",width=1,height=1,fg="red",command=self.RepeatOFF,cursor="hand2")
        self.RepeatOnOff2.place(x=317,y=175)
        self.TextCopyright = Label(self.window,text="")
        self.TextCopyright.place(x=173,y=174)
        self.Copyright = Button(self.window,text="(C)",overrelief="groove",width=3,height=2,fg="yellow",command=self.AllRightReserved,cursor="hand2",activeforeground="orange")
        self.Copyright.place(x=5,y=253)
        self.HelpProgram = Button(self.window,text="Help",overrelief="groove",width=4,height=2,fg="#beff9c",command=self.HELP,cursor="hand2",activeforeground="green")
        self.HelpProgram.place(x=34,y=253)
        self.butonHelp = Button(self.window,text="Help\nButton",overrelief="groove",width=6,height=2,fg="#beff9c",command=self.DecorateButton,cursor="hand2",activeforeground="green")
        self.butonHelp.place(x=69,y=253)
        self.butonOptions = Button(self.window,text="Setting",overrelief="groove",width=5,height=2,fg="#beff9c",command=self.Settigs,cursor="hand2",activeforeground="green")
        self.butonOptions.place(x=116,y=253)
        self.SaveTracks = Button(self.window,text="Save all tracks \nin list presents",fg="#beff9c",overrelief="groove",width=12,height=2,command=self.SaveListTracks,cursor="hand2",activeforeground="green")
        self.SaveTracks.place(x=157,y=253)
        self.RemoveTrack = Button(self.window,text="Remove track\npresent",fg="#beff9c",overrelief="groove",width=11,height=2,command=self.RemoveOneTrackOfList,cursor="hand2",activeforeground="green")
        self.RemoveTrack.place(x=240,y=253)
        self.Vol = Scale(self.window,cursor="sb_h_double_arrow",fg="#beff9c",orient="horizontal",activebackground="#B99309",label="Volume:",sliderrelief="groove",sliderlength=14,troughcolor="green4",borderwidth=5,command=self.VolumeCtrl)
        self.Vol.place(x=290,height=70,width=97)
        self.Vol.set(40)
        self.PositionLoudSpeak = Scale(self.window,to=2,cursor="sb_h_double_arrow",fg="#beff9c",orient="horizontal",activebackground="#B99309",label="Panning:",sliderrelief="groove",sliderlength=14,troughcolor="green4",borderwidth=5,command=self.CtrlLoudSpeaker)
        self.PositionLoudSpeak.place(x=203,y=85,height=70,width=64)
        self.PositionLoudSpeak.set(1)
        self.Tone = Scale(self.window,cursor="sb_h_double_arrow",fg="#beff9c",orient="horizontal",activebackground="#B99309",label="Tone track:",sliderrelief="groove",sliderlength=14,troughcolor="green4",borderwidth=5,command=self.TrackTone)
        self.Tone.place(x=290,y=85,height=70,width=97)
        self.Tone.set(100)
        self.PositionTrack = Scale(self.window,cursor="sb_h_double_arrow",command=self.ChangePosition,fg="#beff9c",orient="horizontal",activebackground="#B99309",label="Position Track:",sliderrelief="groove",sliderlength=14,troughcolor="green4",borderwidth=5)
        self.PositionTrack.place(x=10,y=85,height=70,width=170)
        self.presentation1 = Label(self.window,text = "♫ ♪"*22,fg="blue")
        self.presentation1.place(x=4,y=65)
        self.presentation2 = Label(self.window,text = "_"*15+"Report of reproduction"+"_"*15,fg="yellow")
        self.presentation2.place(x=4,y=154)
        self.presentation3 = Label(self.window,text = "Quantity of reproductions: ",fg="green4")
        self.presentation3.place(x=4,y=174)
        self.presentation4 = Label(self.window,text = "Length of Track: ",fg="green4")
        self.presentation4.place(x=4,y=194)
        self.presentation5 = Label(self.window,text = "Number of Track: ",fg="green4")
        self.presentation5.place(x=4,y=214)
        self.presentation6 = Label(self.window,text = "Name of Track: ",fg="green4")
        self.presentation6.place(x=4,y=234)
        self.decorum = Label(self.window,text = "♫ ♪"*22,fg="blue")
        self.decorum.place(x=4,y=290)
        Config = cPickle.load(file("Config.MPlayM","r"))
        self.window.tk_setPalette(Config[0])
        self.WindowConfiguration = None

    def OpenFiles(self):
        RouteMP3 = tkFileDialog.askopenfilenames(filetypes = (("Canciones", "*.mp3"),))
        if RouteMP3:
            self.window.title("MP3 play music: Loading...")
            if self.Tracks[0] == None: self.Tracks.remove(None)
            num = 1
            for MP3 in RouteMP3:
                print str(num)+"\t",MP3,"open, size in MB:",float((os.path.getsize(MP3) / 1024)) / 1024
                opener = audiere.open_device()
                try:
                    clip = opener.open_file(MP3)
                    self.Tracks.append(clip)
                    self.NameTrack.append(MP3)
                except:
                    text = "Not possible open files nick with accent/s or other error ocurred\nplease play other music.mp3\nNot open "+MP3
                    print text
                    tkMessageBox.showwarning("Error MP3 play music",text)
                num += 1
            print "final opens"
            if not self.Tracks: self.Tracks = [None]
            self.ActualizationWindow()
       
    def LoadRecentFiles(self):
        File = file("Tracks.MPlayM","r")
        Tracks = cPickle.load(File)
        Tracks[0]
        File.close()
        if Tracks[0]:
            self.window.title("MP3 play music: Loading...")
            if self.Tracks[0] == None: self.Tracks.remove(None)
            num = 1
            for MP3 in Tracks:
                print str(num)+"\t",MP3,"open, size in MB:",float((os.path.getsize(MP3) / 1024)) / 1024
                self.NameTrack.append(MP3)
                opener = audiere.open_device()
                clip = opener.open_file(MP3)
                self.Tracks.append(clip)
                num += 1
            print "final opens"
            self.ActualizationWindow()
        else:
            self.patience += 1
            if self.patience > 5:
                tkMessageBox.showerror("Calm, error","Not recent files")
                self.patience = 0

    def SaveListTracks(self):
        if self.Tracks[0]:
            File = file("Tracks.MPlayM","w")
            NamesTracks = self.NameTrack
            cPickle.dump(NamesTracks,File)
            File.close()
        else:
            self.patience2 += 1
            if self.patience2 > 5:
                tkMessageBox.showerror("Calm, error","Not files in list reproduction\nbye")
                self.patience2 = 0

    def PlayMP3(self):
        if self.Tracks[0]:
            if self.Tracks[self.TrackPresent].playing:
                self.Tracks[self.TrackPresent].reset()
            else:
                self.Tracks[self.TrackPresent].play()
                self.ActualizationWindow()
            self.CtrlLoudSpeaker()
            self.VolumeCtrl()
            self.TrackTone()
            self.CheckRepeat()
               
    def PauseMP3(self):
        if self.Tracks[0]:
            if self.Tracks[self.TrackPresent].playing:
                self.Tracks[self.TrackPresent].pause()
            else:
                self.PlayMP3()
               
    def StopMP3(self):
        if self.Tracks[0]:
            self.Tracks[self.TrackPresent].stop()

    def CheckRepeat(self,change=None):
        if change == "ON":
            self.ONOFFtext["fg"] = "green"
            self.ONOFFtext["text"] = "ON"
        elif change == "OFF":
            self.ONOFFtext["fg"] = "red"
            self.ONOFFtext["text"] = "OFF"
        if self.Tracks[0]: #checkup if not or yes repeatin track
            if self.ONOFFtext["text"] == "ON":
                self.Tracks[self.TrackPresent].repeating = True
                if not self.Tracks[self.TrackPresent].playing:
                    self.PlayMP3()
            else:
                self.Tracks[self.TrackPresent].repeating = False
    def RepeatON(self):
        self.CheckRepeat("ON")
        self.RepeatOnOff1.flash()
    def RepeatOFF(self):
        self.CheckRepeat("OFF")
        self.RepeatOnOff2.flash()

    def ChangeTrackUp(self):
        if self.Tracks[0]:
            if self.TrackPresent < len(self.Tracks)-1:
                self.StopMP3()
                self.TrackPresent += 1
                self.PlayMP3()
       
    def ChangeTrackDown(self):
        if self.Tracks[0]:
            if self.TrackPresent > 0:
                self.StopMP3()
                self.TrackPresent -= 1
                self.PlayMP3()

    def CtrlLoudSpeaker(self,Type=None):
        if self.Tracks[0]:
            num = self.PositionLoudSpeak.get()
            if num == 0:
                number = -1
            elif num == 1:
                number = 0
            elif num == 2:
                number = 1
            self.Tracks[self.TrackPresent].pan = number

               
    def TrackTone(self,E=None):
        self.Tone["state"] = "normal" if (self.Tracks[0]) else "disable"
        if self.Tracks[0]:
            self.Tracks[self.TrackPresent].pitchshift = (self.Tone.get() / 100.0)

    def ChangePosition(self,E=None):
        self.PositionTrack["state"] = "normal" if (self.Tracks[0]) else "disable"
        if self.Tracks[0] and E != "active":
            self.PositionTrack["to"] = self.Tracks[self.TrackPresent].length
            self.Tracks[self.TrackPresent].position = self.PositionTrack.get()
           
    def VolumeCtrl(self,E=None):
        self.Vol["state"] = "normal" if (self.Tracks[0]) else "disable"
        if self.Tracks[0]:
            self.Tracks[self.TrackPresent].volume = (self.Vol.get() / 100.0)

    def RecetListReproductions(self):
        if self.Tracks[0]:
            option = tkMessageBox.askokcancel("Recet list of reproduction?","you decide recet list of reprodutions?")
            if option:
                self.StopMP3()
                self.NameTrack = []
                self.Tracks = [None]
                self.ActualizationWindow()
                if (platform.system() == "Windows"):
                    os.system("CLS")
        else:
            self.patience3 += 1
            if self.patience3 > 5:
                tkMessageBox.showerror("Calm, error","Not files in list reproduction\nbye")
                self.patience3 = 0
               
    def RemoveOneTrackOfList(self):
        if self.Tracks[0]:
            self.StopMP3()
            self.Tracks.remove(self.Tracks[self.TrackPresent])
            self.NameTrack.remove(self.NameTrack[self.TrackPresent])
            if not self.Tracks:
                self.Tracks = [None]
                if (platform.system() == "Windows"):
                    os.system("CLS")
            if self.TrackPresent > 0: self.TrackPresent -= 1
            self.ActualizationWindow()
        else:
            self.patience4 += 1
            if self.patience4 > 5:
                tkMessageBox.showerror("Calm, error","Not files in list reproduction\nbye")
                self.patience4 = 0
           
    def ActualizationWindow(self):
        if self.Tracks[0]:
            nam = self.NameTrack[self.TrackPresent].split("/")[-1]
            Quantity = str(len(self.Tracks))
            Length = str(self.Tracks[self.TrackPresent].length)
            Present = str(self.TrackPresent+1)
            Name = nam[:-4] if (len(nam) < 40) else nam[:40][:-4]+" ..." #named track very long
            TitleWindow = " :: "+Name
        else:
            Quantity = ""
            Length = ""
            Present = ""
            Name = ""
            TitleWindow = ""
        self.TrackTone() #<-active scale
        self.VolumeCtrl() #<-active scale
        self.ChangePosition("active") #<-active scale
        self.presentation3["text"] = "Quantity of reproductions: "+Quantity
        self.presentation4["text"] = "Length of Track: "+Length
        self.presentation5["text"] = "Number of Track: "+Present
        self.presentation6["text"] = "Name of Track: "+Name
        self.window.title("MP3 play music"+TitleWindow)

    def DecorateButton(self):
        self.buton1["text"] = "▲\nopen\ntrack" if (self.HelpOnOff == "on") else "▲"
        self.buton2["text"] = "██\nstop\ntrack" if (self.HelpOnOff == "on") else "██"
        self.buton3["text"] = "►\nplay\ntrack" if (self.HelpOnOff == "on") else "►"
        self.buton4["text"] = "▐▐\npause\ntrack" if (self.HelpOnOff == "on") else "▐▐"
        self.buton5["text"] = "▐◄\ntrack\ndown" if (self.HelpOnOff == "on") else "▐◄"
        self.buton6["text"] = "►▌\ntrack \nup" if (self.HelpOnOff == "on") else "►▌"
        if self.HelpOnOff == "on":
            self.HelpOnOff = "off"
        else:
            self.HelpOnOff = "on"

    def SettingsON(self,e):
        self.OptionsOnOff = False
    def Settigs(self):
        if not self.OptionsOnOff:
            self.OptionsOnOff = True
            self.WindowConfiguration = ConfigureMP3PlayMusic()
            self.WindowConfiguration.window.bind("<Destroy>",self.SettingsON)
           

    def HELP(self):
        text = """

Help
----

This program is a really playing mp3/s.
Not possible open files nick with accent/s.
For save list of tracks owe click in button
 "Save list of tracks presents", for load
mp3/s in list save owe click in button
 "load recent tracks".
If you not understand buttons of
 MP3 play music
owe click in button "Help Buttons".

The rest is bread food.

Creator: Leonardo A. Reichert.

Version: 2.1
"""+"-"*34+"\n"*3
        tkMessageBox.showinfo("Help MP3 play music",text)

    def AllRightReserved(self):
        self.TextCopyright["text"] = "Creator: Sokoleonardo 2011" if (self.CopyrightOnOff == "on") else ""
        if self.CopyrightOnOff == "on":
            self.CopyrightOnOff = "off"
        else:
            self.CopyrightOnOff = "on"

if not os.path.exists("Tracks.MPlayM"): #tracks.dat owe exist in dir
    File = file("Tracks.MPlayM","w")
    none = [None]
    cPickle.dump(none,File,2)
    File.close()
   
MyMusic = PlayingMP3()
MyMusic.window.mainloop()

if cPickle.load(file("Config.MPlayM","r"))[1]: #if autosave
    Routes = MyMusic.NameTrack
    if Routes:
        print "autosave..."
        File = file("Tracks.MPlayM","w")
        cPickle.dump(Routes,File,2)
        File.close()

NameAutor = "Leonardo A. Reichert" #in forum is Sokoleonardo

Saludos!
avatar
Sokoleonardo
Moderador de Seccion
Moderador de Seccion

Mensajes : 52
Nivel : 138
Reputación : 4
Fecha de inscripción : 04/08/2011
Vive en Vive en : Argentina

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.