I had two python files one for all the data that made previously and the other file of functions to display the data properly on screen using pygame.
--Functioning--
My idea is that the display of the segments is named alphabetically A,B,C,D,E,F,G

Here, till now every segment is displaying but if you see in my data.py code you can see there is a dictionary called 'final_data' where each number has it's binary code which simply means "How many segments had to glow..." Note:- '1' means to glow and '0' means to not glow, you can say these are buttons. each button has a list of [x,y,width,height] to get display on the screen. I also give the binaries and there positions. The dictionary is working properly the problem is in it's implementation in my second file 'functions.py'.
--Code--
My first file is data.py and the code is......
nums = (0,1,2,3,4,5,6,7,8,9)
binaries = ([1,1,1,1,1,1,0],[1,1,0,0,0,0,0],[1,0,1,1,0,1,1],[1,1,1,0,0,1,1],
[1,1,0,0,1,0,1],[0,1,1,0,1,1,1],[0,1,1,1,1,0,1],[1,1,0,0,0,1,0],[1,1,1,1,1,1,1],[1,1,1,0,1,1,1])
positions = ([200,110,10,50],[200,170,10,50],[150,220,50,10],[140,170,10,50],[140,110,10,50],[150,100,50,10],[150,160,50,10])
final_data = {'0':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [150, 220, 50, 10], [140, 170, 10, 50], [140, 110, 10, 50], [150, 100, 50, 10]], "0": [[150, 160, 50, 10]]},
'1':{"1": [[200, 110, 10, 50], [200, 170, 10, 50]], "0": [[150, 220, 50, 10], [140, 170, 10, 50], [140, 110, 10, 50], [150, 100, 50, 10], [150, 160, 50, 10]]},
'2':{"1": [[200, 110, 10, 50], [150, 220, 50, 10], [140, 170, 10, 50], [150, 100, 50, 10], [150, 160, 50, 10]], "0": [[200, 170, 10, 50], [140, 110, 10, 50]]},
'3':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [150, 220, 50, 10], [150, 100, 50, 10], [150, 160, 50, 10]], "0": [[140, 170, 10, 50], [140, 110, 10, 50]]},
'4':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [140, 110, 10, 50], [150, 160, 50, 10]], "0": [[150, 220, 50, 10], [140, 170, 10, 50], [150, 100, 50, 10]]},
'5':{"1": [[200, 170, 10, 50], [150, 220, 50, 10], [140, 110, 10, 50], [150, 100, 50, 10], [150, 160, 50, 10]],"0": [[200, 110, 10, 50], [140, 170, 10, 50]]},
'6':{"1": [[200, 170, 10, 50], [150, 220, 50, 10], [140, 170, 10, 50], [140, 110, 10, 50], [150, 160, 50, 10]],"0": [[200, 110, 10, 50], [150, 100, 50, 10]]},
'7':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [150, 100, 50, 10]], "0": [[150, 220, 50, 10], [140, 170, 10, 50], [140, 110, 10, 50], [150, 160, 50, 10]]},
'8':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [150, 220, 50, 10], [140, 170, 10, 50], [140, 110, 10, 50], [150, 100, 50, 10], [150, 160, 50, 10]]},
'9':{"1": [[200, 110, 10, 50], [200, 170, 10, 50], [150, 220, 50, 10], [140, 110, 10, 50], [150, 100, 50, 10], [150, 160, 50, 10]], "0": [[140, 170, 10, 50]]}
}
"""
A,B,C,D,E,F,G
1,1,1,1,1,1,0
1,1,0,0,0,0,0
1,0,1,1,0,1,1
1,1,1,0,0,1,1
1,1,0,0,1,0,1
0,1,1,0,1,1,1
0,1,1,1,1,0,1
1,1,0,0,0,1,0
1,1,1,1,1,1,1
1,1,1,0,1,1,1
"""
My second file functions.py
import pygame, sys
pygame.init()
size = width,height = 400,400
running = True
segments = []
screen = pygame.display.set_mode(size)
def draw_rect(x,y,width,height):
pygame.draw.rect(screen,(0,0,0),(x,y,width,height))
def digits():
#A
draw_rect(200,110,10,50)
#B
draw_rect(200,170,10,50)
#C
draw_rect(150,220,50,10)
#D
draw_rect(140,170,10,50)
#E
draw_rect(140,110,10,50)
#F
draw_rect(150,100,50,10)
#G
draw_rect(150,160,50,10)
while running:
screen.fill((148,241,251))
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
key = pygame.key.get_pressed()
if key[pygame.K_q]:
run = False
sys.exit()
digits()
pygame.display.update()
**please tell me in comments do you like my idea? and is the format of asking question is correct. **


repl.it/@Rabbid76/PyGame-7SegementDisplay