python 2.7 - Aptana 3 Pydev not getting Tk() window after running -


i new aptana, , have searched net see how handles gui development.

i have tried following code. shows no bugs in console. however, not give me tk() window named mygui.

from tkinter import * import ttk  def main():     mygui = tk()     mygui.title("my gui new")     mygui.geometry('400x200+200+200')      l = label(mygui, text="help")     l.pack()  if __name__ == "__main__":     main()    

any pointers. able functions run in console, gui development not working out well.

the-it right, want add mygui.mainloop() end of main.

normally when i'm working in tkinter try move of information in function main if... clause. makes larger, more complex interfaces easier handle.

a start use class:

from tkinter import * ttk import *  class app(frame):     def __init__(self, master):         frame.__init__(self, master)         self.pack()         self.create_widgets()      def create_widgets(self):         self.l = label(self, text='help')         self.l.pack()  if __name__ == '__main__':     root = tk()     app = app(root)     root.mainloop() 

the benefits of can introduce toplevels, add additonal widgets (in organized fashion) , have clearer code. can use classes make templates other widgets; in case, building special frame class , giving whatever attributes want. same can done buttons, entries, , other frames. i'm not familiar aptana3, should work no problem. make sure indentation consistent.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -