Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

Board from roulette game

$
0
0

I have made the board from the roulette, but i have a problem with the distance between the boxes which I have made buttons

from tkinter import *def color_button(row, col):    if col == 2 and row in (0, 2, 3, 5, 6, 8, 11):        return "red"    elif col == 3 and row in (1, 4, 7, 10):        return "red"    elif col == 4 and row in (0, 2, 5, 6, 8, 9,  11):        return "red"    else:        return "black"table = Tk()# create the first button[enter image description here](https://i.stack.imgur.com/jgbto.png)Button(table, text="0", borderwidth=1, bg='green', fg="white", width=90, height=2).grid(row=0, column=0, sticky='sw') Button(table,  borderwidth=0, bg='red',height=15,  width=5).grid(row=1, column=0,sticky='sw') Button(table,  borderwidth=0, bg='black',height=15,  width=5).grid(row=2, column=0, columnspan=1, sticky='sw')# Προσθήκη sticky='w'Button(table,text="1-12",  borderwidth=1, bg='green',fg='white',height=10,  width=5).grid(row=1, column=1, sticky='w') # Αλλαγή columnspan=2Button(table,text="13-24",  borderwidth=1, bg='green',fg='white',height=10,  width=5).grid(row=2, column=1, sticky='w') # Αλλαγή columnspan=2Button(table,text="24-36",  borderwidth=1, bg='green',fg='white',height=10,  width=5).grid(row=3, column=1, sticky='w') # Αλλαγή columnspan=2# create the rest of the buttons using list comprehensionfor r, row in enumerate(range( 12)):    for c, col in enumerate(range(3)):        Button(table, text=str((r)*3 + c + 1), borderwidth=1, bg=color_button(r, c), fg="white", width=10, height=2).grid(row=r+1, column=c+2, sticky='w') # Προσθήκη sticky='w'table.mainloop()

enter image description here


Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>