示例#1
0
class Application(tk.Frame):
    def __init__(self, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        self.root = root

        menubar = tk.Menu(self.root)
        filemenu = tk.Menu(menubar, tearoff=0)
        filemenu.add_command(label="New Character",
                             command=self.createNewCharacter)
        filemenu.add_command(label="Open File")
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=self.root.destroy)
        menubar.add_cascade(label="File", menu=filemenu)
        self.root.config(menu=menubar)

        self.nb = ttk.Notebook(self.root)
        self.nb.grid(row=0, column=0, sticky="NSEW")

        self.createNewCharacter()

    def createNewCharacter(self):
        self.splash = Splash(self.root)

        controller = CharacterController(self.nb)
        controller.char.charName.trace("w",
                                       lambda i, o, x, name=controller.char.
                                       charName: self.changeTabText(name))
        self.nb.add(controller.view, text="New Character", padding=5)

        self.splash.destroy()

    def changeTabText(self, name):
        self.nb.tab(self.nb.select(), text=name.get())
示例#2
0
        splash.update_idletasks()
        splash.deiconify()
        myapp.update()

        # application initialization
        myapp.initialize()
        for i in range(0, len(files)):
            if i > 0:
                myapp.add_new_paper()
            if os.path.isfile(files[i]):
                myapp.load_CDML(file=files[i], replace=1)
            else:
                myapp.set_file_name(files[i], check_ext=1)

        # destroy splash
        splash.destroy()
        del splash

    # start the application
    g = Store.pm.get_preference('geometry')
    if g:
        geometry = g
    else:
        geometry = "640x480+10+10"
    myapp.geometry(geometry)
    myapp.update_idletasks()
    myapp.deiconify()
    myapp.mainloop()
    myapp.destroy()

# the module was imported from outside
示例#3
0
      if i > 0:
        myapp.add_new_paper()
      if os.path.isfile( files[i]):
        myapp.load_CDML( file=files[i], replace=1)
      else:
        myapp.set_file_name( files[i], check_ext=1)

    ## here we try to load psyco - this could speed things up
##     try:
##       import psyco
##       psyco.profile()
##     except ImportError:
##       pass

    # destroy splash
    splash.destroy()
    del splash

  # start the application
  g = Store.pm.get_preference( 'geometry')
  if g:
    geometry = g
  else:
    geometry = "640x480+10+10"
  myapp.geometry(geometry)
  myapp.update_idletasks()
  myapp.deiconify()
  myapp.mainloop()
  #import profile
  #profile.run( 'myapp.mainloop()')
  #print "BKChem finished"