Thursday, 15 May 2014

python - Tkinter code won't work -


I'm learning python from an e-book. Right now I am learning about the typicator module

The book has suggested running the following code. However, this should work as much as anyone should consider? Tkinter import * window = (Tk 200x200) my_frame = frames (my_frame.pack button1 = button (my_frame, text = "I (100x150)" button

  1. Place (x = 100, y = 150) button 2 = button (my_frame, text = "i (0 x 0)") button 2. place (x = 0, y = 0, width = 100, height = 50) window.mainloop ()  

What do I need: image description here Enter

What do I get:

After adding the button 1.pack () and button 2.pack () I get it:

The smallest change I make to get my code working If so, then you have to give it the same size:

  from the tanker import * window = TC () Window .geometry ("300x30 0") # Note the change in this line my_frame = frame (window, width = 300, height = 300) my_frame.pack () # Added parentheses here Note button 1 = Button (my_frame , Text = "I (100x150) "button 1. Install (x = 100, y = 150) button2 = button (my_frame, text =" i (0 x 0) ") button 2. place (x = 0, y = 0 , Width = 100, height = 50) window.mainloop ()  

In addition, pack () should be a function call, so add parentheses


No comments:

Post a Comment