My graphics don't look good with my buttons


Joined
Feb 14, 2022
Messages
33
Reaction score
2
hi I am kiaan I am nine years old I am making my first app graphics and my buttons don't look that good can someone help with this problem I am coding In python this is the code for the graphics
code:
import turtle
t = turtle.Turtle()

t.penup()
t.forward(295)
t.right(90)
t.pendown()
t.forward(256.5)
t.right(90)
t.forward(600)
t.right(90)
t.forward(510)
t.right(90)
t.forward(600)
t.right(90)
t.forward(295)
t.penup()
t.forward(215)
t.right(90)
t.forward(600)
t.right(90)
t.forward(507.5)
t.right(90)
t.forward(300)
t.right(90)
t.forward(230)
t.pendown()
list1 = ["purple","red","blue","green","orange"]
for i in range(200):
t.color(list1[i%5])
t.pensize(i/10+1)
t.forward(i)
t.left(59)
turtle.done()

and this is how it looks
how it looks: pls check the attachment

and this is the code for the button
code:
import turtle
t = turtle.Turtle()
t.hideturtle()

s = turtle.Screen()

for i in range(2):
t.forward(80)
t.left(90)
t.forward(30)
t.left(90)

Button_x = 0
Button_y = 0
Button_xButtonlength = 80
Button_yButtonWidth = 30

t.penup()
t.goto(7, 6)
t.write("Start/Run", font=("Arial",12,"normal"))
def Button_click(x, y):
if Button_x <= x and x <= Button_x + Button_xButtonlength:
if Button_y <= y and y <= Button_y + Button_yButtonWidth:
output = tio = print("75 days are something minutes")
something = print(75*24*60)
print(tio)

s.onclick(Button_click)
s.mainloop()

and this is how it looks
how it looks: pls check the attachment


this is the code for both of them
code:
t.hideturtle()

s = turtle.Screen()

for i in range(2):
t.forward(80)
t.left(90)
t.forward(30)
t.left(90)

Button_x = 0
Button_y = 0
Button_xButtonlength = 80
Button_yButtonWidth = 30

t.penup()
t.goto(7, 6)
t.write("Start/Run", font=("Arial",12,"normal"))
def Button_click(x, y):
if Button_x <= x and x <= Button_x + Button_xButtonlength:
if Button_y <= y and y <= Button_y + Button_yButtonWidth:
output = tio = print("75 days are something minutes")
something = print(75*24*60)
print(tio)

s.onclick(Button_click)
s.mainloop()


and this is how it looks together
this is how it looks:pls check the attachment
can someone help me with this problem
 

Attachments

  • graphic actual.jpg
    graphic actual.jpg
    69.4 KB · Views: 13
  • working button.jpg
    working button.jpg
    30.7 KB · Views: 11
  • buttons and graphics.jpg
    buttons and graphics.jpg
    68.2 KB · Views: 12
Ad

Advertisements

Joined
Mar 3, 2021
Messages
243
Reaction score
29
Can you please re-post your code as a single script and use the code tags to preserve your indentation?
 
Joined
Feb 14, 2022
Messages
33
Reaction score
2
Can you please re-post your code as a single script and use the code tags to preserve your indentation?
ok I can do that
code:
import turtle
t = turtle.Turtle()

t.penup()
t.forward(295)
t.right(90)
t.pendown()
t.forward(256.5)
t.right(90)
t.forward(600)
t.right(90)
t.forward(510)
t.right(90)
t.forward(600)
t.right(90)
t.forward(295)
t.penup()
t.forward(215)
t.right(90)
t.forward(600)
t.right(90)
t.forward(507.5)
t.right(90)
t.forward(300)
t.right(90)
t.forward(230)
t.pendown()
list1 = ["purple","red","blue","green","orange"]
for i in range(200):
t.color(list1[i%5])
t.pensize(i/10+1)
t.forward(i)
t.left(59)

t.hideturtle()

s = turtle.Screen()

for i in range(2):
t.forward(80)
t.left(90)
t.forward(30)
t.left(90)

Button_x = 0
Button_y = 0
Button_xButtonlength = 80
Button_yButtonWidth = 30

t.penup()
t.goto(7, 6)
t.write("Start/Run", font=("Arial",12,"normal"))
def Button_click(x, y):
if Button_x <= x and x <= Button_x + Button_xButtonlength:
if Button_y <= y and y <= Button_y + Button_yButtonWidth:
output = tio = print("75 days are something minutes")
something = print(75*24*60)
print(tio)

s.onclick(Button_click)
s.mainloop()
 
Joined
Mar 3, 2021
Messages
243
Reaction score
29
Still need the code tags. Python's annoying. Before you paste your script, hit the button on the editor that looks like "</>" and paste it in there. Sorry I've been AWOL, life gets messy.
 
Ad

Advertisements

Joined
Feb 14, 2022
Messages
33
Reaction score
2
Still need the code tags. Python's annoying. Before you paste your script, hit the button on the editor that looks like "</>" and paste it in there. Sorry I've been AWOL, life gets messy.
I have watched a trillion videos on code tags tried a trillion times and nothing worked it also needs HTML and I don't know HTML
can we do it without code tags or can you send me a link to videos to do code tags without HTML
 
Joined
Apr 26, 2022
Messages
6
Reaction score
1
indentation still isn't preserved if you copy and paste.. even with the code tags

Code:
import turtle
t = turtle.Turtle()

t.penup()
t.forward(295)
t.right(90)
t.pendown()
t.forward(256.5)
t.right(90)
t.forward(600)
t.right(90)
t.forward(510)
t.right(90)
t.forward(600)
t.right(90)
t.forward(295)
t.penup()
t.forward(215)
t.right(90)
t.forward(600)
t.right(90)
t.forward(507.5)
t.right(90)
t.forward(300)
t.right(90)
t.forward(230)
t.pendown()
list1 = ["purple","red","blue","green","orange"]
for i in range(200):
t.color(list1[i%5])
t.pensize(i/10+1)
t.forward(i)
t.left(59)

t.hideturtle()

s = turtle.Screen()

for i in range(2):
t.forward(80)
t.left(90)
t.forward(30)
t.left(90)

Button_x = 0
Button_y = 0
Button_xButtonlength = 80
Button_yButtonWidth = 30

t.penup()
t.goto(7, 6)
t.write("Start/Run", font=("Arial",12,"normal"))
def Button_click(x, y):
if Button_x <= x and x <= Button_x + Button_xButtonlength:
if Button_y <= y and y <= Button_y + Button_yButtonWidth:
output = tio = print("75 days are something minutes")
something = print(75*24*60)
print(tio)

s.onclick(Button_click)
s.mainloop()
[CODE]
 
Ad

Advertisements

Joined
Jul 24, 2022
Messages
6
Reaction score
0
If you want some good quality looking buttons I suggest you use a whole different module named customtkinter.
It allows you to build GUI (like that button you're trying to make, and has some other cool features!)
All you need to install it is:
Code:
pip install customtkinter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top