coding style - Python Tkinter Custom Window -


i have simple tkinter custom window. beginner , learnt tkinter few months ago. have no experience in real software development. so, know if way coded acceptable? know when acceptable , mean lot of things. want know things should improve in coding style & way think?

import tkinter tk  ''' creating tkinter tk instance ''' class application(tk.tk):     def __init__(self,*args,**kwargs):         tk.tk.__init__(self,*args,**kwargs)         self.bind("<buttonpress-1>", self.startmove)         self.bind("<buttonrelease-1>", self.stopmove)         self.bind("<b1-motion>", self.onmotion)         self.init()         self.layout()         self.addbuttons()      ''' setting main tk window size & styles '''     def init(self):         self.geometry("1280x700+0+0")         self.overrideredirect(true)         self['background'] = '#201f29'         self['highlightthickness'] = 2         self['relief'] = 'groove'      '''layout of tk window'''     def layout(self):         self.exitmenu = tk.frame(self)         self.exitmenu.place(x = 1217,  y = 0)         self.container = tk.frame(self,width = 1268,height = 648 , relief = 'flat',bd = 0)         self.container.place(x = 5,y = 40)      ''' adding exit button , minimize button tk window'''     def addbuttons(self):         self.minibutton = tk.button(self.exitmenu,text = '0',font=('webdings',8,'bold'),relief = 'flat' , command = self.minimize )         self.minibutton.pack(side = 'left')         self.exitbutton = tk.button(self.exitmenu,text = 'r',font=('webdings',8),relief = 'flat' ,bg = '#db6b5a', command = self.destroy )         self.exitbutton.pack(side = 'left')      def minimize(self):         self.overrideredirect(false)         self.wm_state('iconic')         self.overrideredirect(true)      '''methods moving window frame'''     def startmove(self, event):         self.x = event.x         self.y = event.y      def stopmove(self, event):         self.x = none         self.y = none      def onmotion(self, event):         x1 = self.x         y1 = self.y         x2 = event.x         y2 = event.y         deltax = x2 - x1         deltay = y2 - y1         = self.winfo_x() + deltax         b = self.winfo_y() + deltay         self.geometry("+%s+%s" % (a, b))   def main():     app = application()     app.mainloop()  if __name__ == "__main__":     main() 

read pep-8 install , run 1 or of pep8 checker, pyflakes, pychecker, pylint.

the first thing stands out docstrings supposed within function rather before - become part of function code , can accessed help.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -