Seems like python is partial
<p>The following is a function I created, and put it in a file called last_function.py</p>

<pre><code>from tkinter import*


def new_gui(app,sound_file,mixer):

    track=mixer.Sound(sound_file)
    def track_toggle():
        if ballCheckbutton.get()==1:

            track.play(loops=-1)
        else:
            track.stop()

    ballCheckbutton=IntVar()    
    c1=Checkbutton(app,text="check me out",command=track_toggle,variable=ballCheckbutton)
    c1.pack(side=LEFT)

    ballScale=DoubleVar()

    def ScaleVolume(v):
        track.set_volume(ballScale.get())

    ballScale.set(track.get_volume())
    s1=Scale(app,variable=ballScale,resolution=0.1,command=ScaleVolume,orient=HORIZONTAL,from_=0.0,to=1.0,label="volume")
    s1.pack()
</code></pre>

<p>and this is the file i use.. to call the code and run it..</p>

<pre><code>from tkinter import *
import pygame.mixer
from last_function import*

app=Tk()
mixer=pygame.mixer
mixer.init()
new_gui(app,"49119_M_RED_HardBouncer.wav",mixer)


def close():
    mixer.stop()
    app.destroy()

app.protocol("WM_DELETE_WINDOW",close)
app.mainloop()
</code></pre>

<p>Everything works fine.. but my query is...</p>

<p>1> Why can't I remove <code>from tkinter import*</code> from the last_function file.. cause anyway it's got that on the top of the file that's calling it right. Why do I get an error saying IntVar() not defined.</p>

<p>2> Why do I have to pass <code>mixer</code> as a parameter in the function? can the function not inherit it directly from <code>import pygame.mixer</code>that's on top of the file calling it?<br>
 What I mean to say is. THERE ARE TKINTER COMPONENTS ALSO BEING USED, BUT I DON'T PASS TKINTER AS A PARAMETER.. Do I ! then why is there this... selective parameter assignment??</p>

<p>I'm really confused!!!  </p>
