Esempio n. 1
0
for line in fp:
    t = line.split('\t')
    name = t[2].strip()
    lb.insert(END, name)

# tell the listbox and the scrollbar about each other
lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)

# FRAME 4

g.col()

# te is for text entry
te = g.te(height=5, width=40)
te.insert(END, "This is a Text widget.\n")
te.insert(END, "It's like a little text editor.\n")
te.insert(END, "It has more than one line, unlike an Entry widget.\n")

# st is for scrollable text
st = g.st()
st.text.configure(height=5, width=40)

st.text.insert(END, "This is a Scrollable Text widget.\n")
st.text.insert(END, "It is defined in Gui.py\n")

for i in range(100):
    st.text.insert(END, "All work and no play.\n")

g.endcol()
Esempio n. 2
0
for line in fp:
    t = line.split("\t")
    name = t[2].strip()
    lb.insert(END, name)

# tell the listbox and the scrollbar about each other
lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)


# FRAME 4

g.col()

# te is for text entry
te = g.te(height=5, width=40)
te.insert(END, "This is a Text widget.\n")
te.insert(END, "It's like a little text editor.\n")
te.insert(END, "It has more than one line, unlike an Entry widget.\n")

# st is for scrollable text
st = g.st()
st.text.configure(height=5, width=40)

st.text.insert(END, "This is a Scrollable Text widget.\n")
st.text.insert(END, "It is defined in Gui.py\n")

for i in range(100):
    st.text.insert(END, "All work and no play.\n")

g.endcol()
from swampy.Gui import *
g = Gui()
g.title("Gui")


text = g.te(width=100, height=5)
canvas = g.ca(width=300, height=300)
canvas.config(bg='grey')
circle = None
def change_color():
    global circle
    color = entry.get()
    print color
    if circle == None:
        return
    circle.config(fill=color)

def draw_circle():
    global circle
    circle = canvas.circle([0, 0], 100, fill='red')

g.bu(text='create circle', command=draw_circle)
entry = g.en()
g.bu(text='change color', command=change_color)



g.mainloop()
Esempio n. 4
0
item.config(fill='yellow', outline='orange', width=10)
# coordinate sequences
canvas.rectangle([0, 0], [200, 200], fill='blue', outline='orange', width=10)
# oval takes a bounding box and draws an oval within rectangle
canvas.oval([[0, 0], [200, 100]], outline='orange', width=10)
canvas.line([[0, 100], [100, 200], [200, 100]], width=10)
# polygon takes same args, but draws the last leg of polygon and fills
canvas.polygon([[0, 100], [100, 200], [200, 100]],
               fill='red',
               outline='orange',
               width=10)
# widgets
# en creates new entry
entry = g.en(text='default text')
# te grecreates text widget
text = g.te(width=100, height=5)
text.insert(END, 'A line of text')
text.insert(1.1, 'nother')


# packing widgets
class SimpleTurtleWorld(TurtleWorld):
    def setup(self):
        """create the GUI"""

        self.row()

        self.canvas = self.ca(width=400, height=400, bg='white')

        # right frame
        self.col()