Can Python Be Used To Create A Simple IPA File?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tommys lees
    New Member
    • Dec 2011
    • 1

    Can Python Be Used To Create A Simple IPA File?

    Im new to Python and programming itself, I was wondering if someone could tell me if Python can be used to create an IPA file. Something very simple, for example, could someone try to summarize how creating an application that just displays a screen with two buttons (the buttons will be PNG files) that can take the user to another screen depending on the button they choose. If could give me some info and codes that would be very helpful.
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    This can be accomplished with Tkinter. You can display an image on a Tkinter.Button instead of text with the keyword image (image="image.p ng"). You can assign a command to the buttons that will spawn child windows. Here's a simple example with buttons:
    Code:
    from Tkinter import *
    from itertools import cycle
    
    class SpinLabel(Frame):
        def __init__(self, master=None):
            Frame.__init__(self, master)
            self.pack(fill=BOTH, expand=1)
            self.master.title("Spin Characters")
            self.textList = ["/", "--", "\\", "--", "|"]
            buttonFrame = Frame(self)
            self.btnList = []
            for i, name in enumerate(["Start", "Stop", "Exit"]):
                def handler(i=i):
                    return self.manage_spin(i)
                btn = Button(buttonFrame, text=name, padx=5, pady=5,
                             bd=4, bg='#ff0', fg="#00f",
                             activebackground = "#00f",
                             activeforeground = "#ff0",
                             font=("Arial", 16, "bold"),
                             relief='raised',
                             command=handler)
                btn.pack(side="left", fill=BOTH, expand=1)
                self.btnList.append(btn)
            buttonFrame.pack(fill=BOTH, expand=1)
            
            self.spin = Label(self, font=("Courier New", 24, 'bold'),fg='#000')
            self.spin.pack(side="top", fill=BOTH, expand=1)
            self.spinChrs = cycle(self.textList)
    
        def manage_spin(self, idx):
            if idx == 0:
                self.btnList[0].configure(state=DISABLED)
                self.spinning = True
                self.loopchrs()
            elif idx == 1:
                self.btnList[0].configure(state=NORMAL)
                self.spinning = False
                self.spin.config(text="")
            elif idx == 2:
                self.master.destroy()
    
        def loopchrs(self):
            if self.spinning:
                self.spin.config(text=self.spinChrs.next())
                self.spin.update_idletasks()
                self.spin.after(100, self.loopchrs)
    
    if __name__ == "__main__":
        app = SpinLabel()
        app.mainloop()

    Comment

    Working...