DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Python (http://www.daniweb.com/forums/forum114.html)
-   -   Best GUI toolkit? (http://www.daniweb.com/forums/thread62619.html)

danizzil14 Nov 24th, 2006 11:07 pm
Best GUI toolkit?
 
Ok, so I'm gonna work on a program, and I want to enable a gui for it.

I have a few questions though...

Question: Are there any out there that wont need a class structure? (I;ve never gotten them, and I'm working on them right now...)

Question: How about easily updated and most versitile?

Question: In your opinion, which is best?

iamthwee Nov 25th, 2006 11:03 am
Re: Best GUI toolkit?
 
I think visual studio, is insanely easy to create a good looking gui.

Of course you'll need the dotnet framework, but that's not a problem if you don't have it. You just download it. And learning oop is a piece of cake ain't it.

Java as well, with a GUI builder would also be quick and easy. As long as you have a good idea regarding back end programming you shouldn't have a problem.

For python try this:
http://wxglade.sourceforge.net/

Respect, from one blender fan to another.

vegaseat Nov 25th, 2006 1:44 pm
Re: Best GUI toolkit?
 
None of the traditional GUI toolkits for Python require you to use object oriented programming ('OOP has class'), but it makes more complex programs easier to write and maintain. For some additional info see:
http://www.daniweb.com/techtalkforums/thread61194.html

sneekula Nov 27th, 2006 12:00 pm
Re: Best GUI toolkit?
 
I have started to program with windows concepts. It is different then console and that is were the learning curve sets in. Once you realize how to approach a GUI with its frames, windows, dialog boxes, buttons, labels and so on, you will enjoy it. I use Tkinter right now, it is part of the Python installation, and seems to be the easiest GUI toolkit to learn with.

Ene Uran Nov 27th, 2006 12:48 pm
Re: Best GUI toolkit?
 
Hi there danizzil14, I am giving you two examples of a simple Tkinter 'Hello World' code. The first one is without the use of class:
# Tkinter programming without a class

from Tkinter import *

def say_hi():
    # function for hi_button action
    # show new text on the label
    hi_label.config(text="Hi there, everyone!")


# create the basic window
root = Tk()

frame = Frame(root)
frame.pack()
# specify button action with command=function
# foreground/fg is red to color text
q_button = Button(frame, text=" QUIT ", fg="red", command=root.destroy)
q_button.pack(side=LEFT)

hi_button = Button(frame, text=" Hello ", command=say_hi)
hi_button.pack(side=LEFT)
# width of label is in characters
hi_label = Label(frame, text=" Hello, world! ", bg='yellow', width=20)
hi_label.pack(side=LEFT)

# start the event loop to respond to mouse clicks etc.
root.mainloop()
Here is the same program using a class structure:
# Tkinter programming using a class

from Tkinter import *

class App(object):
    """create a frame/window with 2 buttons and a label"""
    def __init__(self, master):
        frame = Frame(master)
        frame.pack()
        # specify button action with command=function
        # foreground/fg is red to color text
        self.q_button = Button(frame, text=" QUIT ", fg="red", command=root.destroy)
        self.q_button.pack(side=LEFT)

        self.hi_button = Button(frame, text=" Hello ", command=self.say_hi)
        self.hi_button.pack(side=LEFT)
        # width of label is in characters
        self.hi_label = Label(frame, text=" Hello, world! ", bg='yellow', width=20)
        self.hi_label.pack(side=LEFT)

    def say_hi(self):
        # function for hi_button action
        # show new text on the label
        self.hi_label.config(text="Hi there, everyone!")

# create the basic window
root = Tk()
# instantiate the App class
app = App(root)
# start the event loop to respond to mouse clicks etc.
root.mainloop()


All times are GMT -4. The time now is 8:14 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC