Hello<div>I changed the code as follows.But still the callback function is not working.</div><div>The he() is working well but clicking on the frame has no result.</div><div><br></div><div><br></div><div><div>class app:</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;def __init__(self,root):</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>frame=Frame(root)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>frame.bind(&quot;&lt;Button-1&gt;&quot;, callback)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>frame.pack()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.button=Button(root,text=&#39;quit&#39;,fg=&#39;red&#39;,command=frame.quit)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>self.button.pack(side=&#39;left&#39;)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.hi=Button(root,text=&#39;hi&#39;,fg=&#39;SystemWindowFrame&#39;,command=self.hi)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>self.hi.pack(side=&#39;right&#39;)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.callback</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;def hi (self):<span class="Apple-tab-span" style="white-space:pre">                </span>print &#39;hello! there&#39;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;def callback(self,event): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print &quot;clicked at&quot;, event.x, event.y</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
<div>&gt;&gt;&gt; root=Tk()</div><div>&gt;&gt;&gt; xx=app(root)</div><div>&gt;&gt;&gt; root.mainloop()</div><div>hello! there</div><div>hello! there</div><div><br></div></div>