when i start my program i write
import graphics *
but then when i try to create a button it doesn't work
anyone know the problem??thanks
There is no button in graphics.py. How exactly are you trying to create one?
graphics.py is a simple wrapper for Tkinter written by the author of a Python book. It mostly contains renamed canvas routines.
I would stick with Tkinter itself. You get more help this way since only a few folks know about this Zelle wrapper.
I think we have brought this up numerous times before:
The graphics.py library is designed to make it very easy for novice programmers to
experiment with computer graphics in an object oriented fashion. It is
written by John Zelle for use with the book "Python Programming: An
Introduction to Computer Science" (Franklin, Beedle & Associates).
The problem is that this is only a tiny subset of Tkinter and very few programmers are using it.
Here is an example how to mimic a crude button ...
# a program to convert Celsius to Fahrenheit using # graphics.py a simple graphical interface # also shows how to create a crude button from graphics import * def main(): win = GraphWin("Celsius Converter", 400, 300) win.setCoords(0.0, 0.0, 3.0, 4.0) # Draw the interface Text(Point(1,3), "Celsius Temperature:").draw(win) Text(Point(1,1), "Fahrenheit Temperature:").draw(win) input = Entry(Point(2,3), 5) input.setText("0.0") input.draw(win) output = Text(Point(2,1),"") output.draw(win) button = Text(Point(1.5,2.0),"Convert It") button.draw(win) Rectangle(Point(1,1.5), Point(2,2.5)).draw(win) while True: # wait for a mouse click (not confined to button) win.getMouse() # convert input celsius = eval(input.getText()) fahrenheit = 9.0/5.0 * celsius + 32 # display output output.setText("%0.1f" % fahrenheit) main()
To me the Tkinter GUI toolkit is about as simple as it comes. If you really want to get into fancy widgets (html, plotting, sound), then switch to wxPython. That however is somewhat of a steep learning curve.
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click Dim txtB1 As New TextBox Dim i For i = ...