Creating gui in python using opengl. How can i make the text boxes which take values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudan20089
    New Member
    • Feb 2013
    • 1

    Creating gui in python using opengl. How can i make the text boxes which take values

    How can i create gui in python using pyopengl?
    Or simply i want to create textbox in python using pyopengl which takes the value entered in text box and the calculation can be conducted. please help me to get through it (p.s. not using thread)
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    My understanding is PyOpenGL is interoperable with PyQt, PyGTK, Tkinter, wxPython and other GUI libraries. I know a little Tkinter and have an example of an entry dialog. It's more than you need, but shows how you can do it with Tkinter.
    Code:
    import Tkinter
    
    textFont1 = ("Arial", 20, "bold italic")
    
    class EntryWidget(Tkinter.Entry):
        def __init__(self, master, initial=""):
            Tkinter.Entry.__init__(self, master=master)
            self.value = Tkinter.StringVar()
            self.config(textvariable=self.value, width=40,
                        relief="ridge", font=textFont1,
                        bg="#ddd", fg="#e00",
                        justify='center')
            self.pack()
            self.value.set(initial)
    
    class App(Tkinter.Tk):
        def __init__(self, title="Case Insensitive Entry"):
            Tkinter.Tk.__init__(self)
            self.title(title)
            self.w = EntryWidget(self, "Enter Text")
            self.w.bind(sequence="<KeyRelease>", func=self.lower)
            self.mainloop()
            self.value = self.w.value.get()
    
        def lower(self, event):
            event.widget.value.set(event.widget.value.get().lower())
            
    if __name__ == "__main__":
        app = App()
        print app.value

    Comment

    Working...