The Aliens Legacy http://forum.alienslegacy.com/ |
|
idea on flash replacement for sentry gun terminal program http://forum.alienslegacy.com/viewtopic.php?f=3&t=19394 |
Page 1 of 3 |
Author: | knoxvilles_joker [ Thu Mar 18, 2021 7:39 pm ] |
Post subject: | idea on flash replacement for sentry gun terminal program |
The kicker is that with pygame you can have great control over what is drawn on the screen and how the display changes. Does anyone have pixel measurements of the screen? |
Author: | knoxvilles_joker [ Sun Mar 21, 2021 7:52 am ] |
Post subject: | |
The gridcase had a resolution of 640x200 pixels and ran a custom ms-dos 2.11 grid os. https://www.old-computers.com/museum/co ... t=1&c=1054 link courtesy of Gman. |
Author: | knoxvilles_joker [ Sun Mar 21, 2021 9:49 am ] |
Post subject: | |
According to this site: https://int10h.org/oldschool-pc-fonts/fontlist/ The most likely font used on the grid cases would have been the IBM MDA font. between lighting and other things I think the pixel differences would have made things difficult to tell font lettering pixel wise. The other possibility is that the batch file that they would have used could have had custom screen made fonts. But knowing time constraints it would have been easier to use built-in fonts instead of making a custom menu lettering scheme. |
Author: | knoxvilles_joker [ Sun Mar 21, 2021 8:42 pm ] |
Post subject: | |
The more and more I look at the sentry gun terminal program the more it appears that, a custom font may have been generated or a custom bitmapped screen character set was used. The IBM MDA TTF font is the closest I have found so far, but, nothing matches perfectly, but, between screen granularity, later upscale of original footage, lighting, and blur from lighting it is not impossible to say that some details may have been lost or skewed creating much of the confusion. |
Author: | knoxvilles_joker [ Sun Mar 21, 2021 10:16 pm ] |
Post subject: | |
This is the code as it stands and I will stress that this is a very primitive deal that uses mouse versus keyboard input at the moment. Code: import pygame
import sys # initializing the constructor pygame.init() # grid case resoolution is 640 x 200 pixels, 80 charactoers x 25 lines monochrome # screen resolution res = (640,200) line_width = 10 # opens up a window screen = pygame.display.set_mode((res), pygame.RESIZABLE) # white color color = (0,3,99) # light shade of the button color_light = (255,255,0) # dark shade of the button color_dark = (100,100,100) # stores the width of the # screen into a variable width = screen.get_width() # stores the height of the # screen into a variable height = screen.get_height() pygame.display.update() # defining a font smallfont = pygame.font.SysFont('Corbel',35) # rendering a text written in # this font text = smallfont.render('quit' , True , color) while True: for ev in pygame.event.get(): if ev.type == pygame.QUIT: pygame.quit() #checks if a mouse is clicked if ev.type == pygame.MOUSEBUTTONDOWN: #if the mouse is clicked on the # button the game is terminated if width/2 <= mouse[0] <= width/2+140 and height/2 <= mouse[1] <= height/2+40: pygame.quit() # fills the screen with a color 60,25,60 # this sets the background color screen.fill((0,0,0)) pygame.draw.rect(screen, color_light, (0, 0, 640, 5), 0) pygame.draw.rect(screen, color_light, (0, 195, 640, 5)) pygame.draw.rect(screen, color_light, (0, 0, 5, 200), 0) pygame.draw.rect(screen, color_light, (635,0,5, 200), 0) # stores the (x,y) coordinates into # the variable as a tuple mouse = pygame.mouse.get_pos() # if mouse is hovered on a button it # changes to lighter shade if width/2 <= mouse[0] <= width/2+140 and height/2 <= mouse[1] <= height/2+40: pygame.draw.rect(screen,color_light,[width/2,height/2,140,40]) else: pygame.draw.rect(screen,color_dark,[width/2,height/2,140,40]) # superimposing the text onto our button screen.blit(text , (width/2+50,height/2)) # updates the frames of the game pygame.display.update() |
Author: | ilovethecorps [ Thu Apr 01, 2021 7:10 am ] |
Post subject: | |
Nice work! |
Author: | martinr1000 [ Thu Apr 01, 2021 10:30 am ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
yep, looking good |
Author: | knoxvilles_joker [ Thu Apr 01, 2021 2:05 pm ] |
Post subject: | |
I will have two version in the end. I will make every attempt for accuracy. One will use a mouse driven interface and another a keyboard driven one. |
Author: | martinr1000 [ Fri Apr 02, 2021 11:46 am ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
Hi, don't know if this helps or not but i had a go at putting a blur method into the mix so it emulates the screen blur in the movie. Not sure what's going on with the text but if it helps i'll keep looking. it's controlled by the numberOfBlurLoops argument passed to the method addBlur(). 0 loops = no blur and then the more loops you have the more blur. I apply blur to the base image that has been rendered in the game loop. once the blur has happened i overlay the original rendered image back on top for clarity although i'm thinking this may be too harsh and could be tweaked. anyway if this is no use to you no problem but it was fun anyway. Attachment: Code: import pygame
from PIL import Image, ImageFilter #convert a pillow image to a pygame surface def pilImageToSurface(pilImage): return pygame.image.fromstring( pilImage.tobytes(), pilImage.size, pilImage.mode).convert() #remove the black background from an image def removeBackground(image): pixeldata = list(image.getdata()) for i,pixel in enumerate(pixeldata): if pixel[:3] == (0,0,0): pixeldata[i] = (0,0,0,0) noBackgroundImage = image noBackgroundImage.putdata(pixeldata) return noBackgroundImage #define method to blur the contents of a surface image def addBlur(numberOfLoops): if numberOfLoops==0: return #create a copy of the surface graphics so that we can remove the black background so that we can overlay it back on top of the blurred image imageNoBlur = pygame.image.tostring(screen, 'RGBA') pilImageNoBlur = Image.frombytes("RGBA", (width, height), imageNoBlur) pilImageNoBlurNoBackground = removeBackground(pilImageNoBlur) noBackgroundNoBlurSurface = pygame.image.fromstring(pilImageNoBlurNoBackground.tobytes('raw', 'RGBA'), (width, height), 'RGBA') #apply blur to the original image. The original image will be overlaid on top of the blurred image for x in range(numberOfLoops): #get the current surface so we can apply blur to it. Subsequent iterations will increase the blur effect imageToBlur = pygame.image.tostring(screen, 'RGBA') pil_blurred = Image.frombytes("RGBA", (width, height), imageToBlur).filter(ImageFilter.GaussianBlur(radius=(numberOfBlurLoops-((x+10)-1)))) blurredSurface = pygame.image.fromstring(pil_blurred.tobytes('raw', 'RGBA'), (width, height), 'RGBA') #first blit the blurred surface screen.blit(blurredSurface, (0, 0)) #now blit the noBackgroundNoBlurSurface surface back for clarity #consider applying a little transparency to this in future screen.blit(noBackgroundNoBlurSurface, (0, 0)) #define driver variables background_colour = (0,0,0) width, height = (640, 200) borderOffset = 20 lineWidth = 5 # light shade of the button color_light = (255,255,0) #setup the display and initialise fonts screen = pygame.display.set_mode((width, height)) pygame.font.init() #define number of blur loops. more loops=more blur, 0=no blur numberOfBlurLoops = 6 # defining a font fontSize = 100 smallfont = pygame.font.SysFont('Rockwell Extra Bold',fontSize) # rendering a text written in # this font text = smallfont.render('Test' , True , color_light) running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False #draw the screen graphics screen.fill(background_colour) pygame.draw.rect(screen, color_light, (borderOffset, borderOffset, width-(2*borderOffset), lineWidth), 0) pygame.draw.rect(screen, color_light, (borderOffset, height-(borderOffset)-lineWidth, width-(2*borderOffset), lineWidth), 0) pygame.draw.rect(screen, color_light, (borderOffset, borderOffset, lineWidth, height-(2*borderOffset)), 0) pygame.draw.rect(screen, color_light, (width-(borderOffset+lineWidth),borderOffset,lineWidth, height-(2*borderOffset)), 0) screen.blit(text, ((width/2)-(text.get_width()/2),(height/2)-(text.get_height()/2))) #add blur effect to screen graphics addBlur(numberOfBlurLoops) pygame.display.flip() pygame.quit() |
Author: | knoxvilles_joker [ Fri Apr 02, 2021 11:17 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
martinr1000 wrote: Hi, don't know if this helps or not but i had a go at putting a blur method into the mix so it emulates the screen blur in the movie. Not sure what's going on with the text but if it helps i'll keep looking. it's controlled by the numberOfBlurLoops argument passed to the method addBlur(). 0 loops = no blur and then the more loops you have the more blur. I apply blur to the base image that has been rendered in the game loop. once the blur has happened i overlay the original rendered image back on top for clarity although i'm thinking this may be too harsh and could be tweaked. anyway if this is no use to you no problem but it was fun anyway. Attachment: Blur.png Code: import pygame from PIL import Image, ImageFilter #convert a pillow image to a pygame surface def pilImageToSurface(pilImage): return pygame.image.fromstring( pilImage.tobytes(), pilImage.size, pilImage.mode).convert() #remove the black background from an image def removeBackground(image): pixeldata = list(image.getdata()) for i,pixel in enumerate(pixeldata): if pixel[:3] == (0,0,0): pixeldata[i] = (0,0,0,0) noBackgroundImage = image noBackgroundImage.putdata(pixeldata) return noBackgroundImage #define method to blur the contents of a surface image def addBlur(numberOfLoops): if numberOfLoops==0: return #create a copy of the surface graphics so that we can remove the black background so that we can overlay it back on top of the blurred image imageNoBlur = pygame.image.tostring(screen, 'RGBA') pilImageNoBlur = Image.frombytes("RGBA", (width, height), imageNoBlur) pilImageNoBlurNoBackground = removeBackground(pilImageNoBlur) noBackgroundNoBlurSurface = pygame.image.fromstring(pilImageNoBlurNoBackground.tobytes('raw', 'RGBA'), (width, height), 'RGBA') #apply blur to the original image. The original image will be overlaid on top of the blurred image for x in range(numberOfLoops): #get the current surface so we can apply blur to it. Subsequent iterations will increase the blur effect imageToBlur = pygame.image.tostring(screen, 'RGBA') pil_blurred = Image.frombytes("RGBA", (width, height), imageToBlur).filter(ImageFilter.GaussianBlur(radius=(numberOfBlurLoops-((x+10)-1)))) blurredSurface = pygame.image.fromstring(pil_blurred.tobytes('raw', 'RGBA'), (width, height), 'RGBA') #first blit the blurred surface screen.blit(blurredSurface, (0, 0)) #now blit the noBackgroundNoBlurSurface surface back for clarity #consider applying a little transparency to this in future screen.blit(noBackgroundNoBlurSurface, (0, 0)) #define driver variables background_colour = (0,0,0) width, height = (640, 200) borderOffset = 20 lineWidth = 5 # light shade of the button color_light = (255,255,0) #setup the display and initialise fonts screen = pygame.display.set_mode((width, height)) pygame.font.init() #define number of blur loops. more loops=more blur, 0=no blur numberOfBlurLoops = 6 # defining a font fontSize = 100 smallfont = pygame.font.SysFont('Rockwell Extra Bold',fontSize) # rendering a text written in # this font text = smallfont.render('Test' , True , color_light) running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False #draw the screen graphics screen.fill(background_colour) pygame.draw.rect(screen, color_light, (borderOffset, borderOffset, width-(2*borderOffset), lineWidth), 0) pygame.draw.rect(screen, color_light, (borderOffset, height-(borderOffset)-lineWidth, width-(2*borderOffset), lineWidth), 0) pygame.draw.rect(screen, color_light, (borderOffset, borderOffset, lineWidth, height-(2*borderOffset)), 0) pygame.draw.rect(screen, color_light, (width-(borderOffset+lineWidth),borderOffset,lineWidth, height-(2*borderOffset)), 0) screen.blit(text, ((width/2)-(text.get_width()/2),(height/2)-(text.get_height()/2))) #add blur effect to screen graphics addBlur(numberOfBlurLoops) pygame.display.flip() pygame.quit() Every piece helps so thanks! When I left off I determined that the default button sizes were going to force a deviation on the 200 horizontal line minimum. At this point I am just trying to get the menus rebuilt. The quandary I was in was that if I made all the button fit on the screen, things would not resize which would cause another issue so I am having to figure that piece out. I am trying to make this universal as far as screen sizes go. I also determined that if we go back to the roots, we need to really do a batch shell script or in this case bash, sh, korn shell, what have you. That it was written in basic c## effectively it should be possible to convert the raw code to python if one can decompile or access the actual source code. That path would be rather lengthy. |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 4:24 am ] |
Post subject: | |
I am running into some brick walls to try and get the menu to look correctly. pygame-menu I am having issues trying to figure out how to use the proper syntax for columns. if I use .pack I am limited to three columns. pygame-menu natively supports arrow key functionality. Ideally I want it to be resizeable. That limits things slightly. I can stacically program the button field sizes but that prevents resizing. Now if I deviate slightly I can allow for resizing so it will fit any screen. The goal is to try and get a code piece that is cross platform with minimal effort AND will stand the test of time. Everything I have read indicates that python will be around for decades to come as it is the power house between many, many things. |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 5:13 am ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
top is current draft and bottom is the flash program. Attachment: I had to deviate on height by 100 pixels additional. This is a resizable setup. The idea here is that this can run to any size screen and still look somewhat screen accurate. Now I like to call these sort of things elephant projects and you eat an elephant one byte at a time. Saying that means you focus on each individual problem and forget the other issues. Get one thing hashed and move on to the next. Code: # Import module
from tkinter import * import tkinter from PIL import Image, ImageTk # Create object root = tkinter.Tk() # Adjust size root.geometry("640x300") root.configure(bg='black') # Specify Grid # options for grid: # MINSIZE, PAD, UNIFORM, WEIGHT Grid.rowconfigure(root,0,weight=1, uniform='a') Grid.rowconfigure(root,1,weight=1, uniform='a') Grid.rowconfigure(root,2,weight=1, uniform='a') Grid.rowconfigure(root,3,weight=1, uniform='a') Grid.rowconfigure(root,4,weight=1, uniform='a') Grid.rowconfigure(root,5,weight=1, uniform='a') Grid.rowconfigure(root,6,weight=1, uniform='a') Grid.rowconfigure(root,7,weight=1, uniform='a') Grid.rowconfigure(root,8,weight=1, uniform='a') Grid.rowconfigure(root,9,weight=1, uniform='a') Grid.columnconfigure(root,0,weight=1, uniform='a') Grid.columnconfigure(root,1,weight=1, uniform='a') Grid.columnconfigure(root,2,weight=1, uniform='a') Grid.columnconfigure(root,3,weight=1, uniform='a') #Grid.columnconfigure(root,4,weight=1, uniform='a') #Grid.rowconfigure(root,0,row=0,weight=0) # notes on different widget options other notes sections will be added for late rreference needs and # desired customizations. # w = Canvas (master, option-value # bd, bg, cursor, highlight color, width, height # w = CheckButton(master, option=value) # Title, activebackground, activeforeground, bg, command, font, image # w=Entry(master, option=value) # bd, bg, cursor, command, highlightcolor, width, height # w=Label(master, option=value) # bg, bd, command, font, image, width, height # w = Listbox(master, option=value) # hightlightcolor, bg, bd, font, image, width, height # w = MenuButton(master, option=value) # activebackground, activeforeground, bg, bd, cursor, image, width, height, highlightcolor # w = Scrollbar(master, option=value) # width, activebackground, bg, bd, cursor # w = Text(master, option=value) # highlightcolor, insertbackground, bg, font, image, width, height # w = tk.menu button(parent, option, ...) # activebackground, activeforeground, anchor, background or bg, cursor, compound, direction, disabledforeground, fg, font, height, highlightbackground, highlightcolor, highlightthickness, image, justify, menu, padx, pady, relief, state, takefocus, text, textvariable, underline, width, wraplength # # # #image files #photo = PhotoImage(file = r"c:\Menu_title.png") # old sentry gun menu title # Specify Framesw = Frame(master, option=value) # bg, bd, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, width # Create Buttons # master, option=value, ... # activebackground, activeforeground, bd, bg, command, fg, font, height, highlightcolor, image, justify, padx, pady, relief, state, underline, width, wraplength button_1 = Button(root,justify=CENTER,text="AUTO-REMOTE") button_2 = Button(root,justify=CENTER,text="HARD") button_3 = Button(root,justify=CENTER,text="SEMIHARD") button_4 = Button(root,justify=CENTER,text="SOFT") sbutton_1 = Button(root,justify=CENTER,text="BIO") sbutton_2 = Button(root,justify=CENTER,text="INERT") tsbutton_1 = Button(root,justify=CENTER,text="MULTI SPEC") tsbutton_2 = Button(root,justify=CENTER,text="INFRA RED") tsbutton_3 = Button(root,justify=CENTER,text="UV") wsbutton_1 = Button(root,justify=CENTER,text="SAFE") wsbutton_2 = Button(root,justify=CENTER,text="ARMED") isbutton_1 = Button(root,justify=CENTER,text="SEARCH") isbutton_2 = Button(root,justify=CENTER,text="TEST") isbutton_3 = Button(root,justify=CENTER,text="ENGAGED") isbutton_4 = Button(root,justify=CENTER,text="INTERROGATE") trbutton_1 = Button(root,justify=CENTER,text="AUTO") trbutton_2 = Button(root,justify=CENTER,text="SELECTIVE") smman = Button(root,justify=CENTER,text="MAN-OVERRIDE") smauto = Button(root,justify=CENTER,text="SEMI-AUTO") gun_1 = Button(root,borderwidth=7,bg='black',relief=RIDGE,disabledforeground='yellow',state=DISABLED,text="kp") gun_2 = Button(root,borderwidth=7,bg='black',fg='yellow',disabledforeground='yellow',state=DISABLED,text="kp") #header = Button(root, image = photo, compound = TOP) # image reference headernew = Button(root, bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER, text="UA 571-C \n REMOTE SENTRY WEAPON SYSTEM") syst = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="SYSTEM \n MODE") weap = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="WEAPON \n STATUS") iff = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="IFF \n STATUS") test = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TEST \n ROUTINE") target = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TARGET PROFILE") spectral = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="SPECTRAL PROFILE") ts = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TARGET SELECT") # bg='black', fg='yellow', highlightbackground='yellow', # Set grid # widget.grid(grid_options) # column, columnspan, ipadx, ipady, padx, pady, row, rowspan, sticky gun_1.grid(row=0,column=0,ipadx=2,ipady=2,padx=2,pady=2,sticky=W) gun_2.grid(row=0,column=3,ipadx=2,ipady=2,padx=2,pady=2,sticky=E) headernew.grid(row=0,column=1,columnspan=2,sticky="NSEW") button_1.grid(row=2,column=0,sticky="NSEW") button_2.grid(row=9,column=0,sticky="NSEW") button_3.grid(row=8,column=0,sticky="NSEW") button_4.grid(row=7,column=0,sticky="NSEW") sbutton_1.grid(row=7,column=1,sticky="NSEW") sbutton_2.grid(row=8,column=1,sticky="NSEW") tsbutton_1.grid(row=7,column=2,columnspan=2,sticky="NSEW") tsbutton_2.grid(row=8,column=2,columnspan=2,sticky="NSEW") tsbutton_3.grid(row=9,column=2,columnspan=2,sticky="NSEW") wsbutton_1.grid(row=2,column=1,sticky="NSEW") wsbutton_2.grid(row=3,column=1,sticky="NSEW") isbutton_1.grid(row=2,column=2,sticky="NSEW") isbutton_2.grid(row=3,column=2,sticky="NSEW") isbutton_3.grid(row=4,column=2,sticky="NSEW") isbutton_4.grid(row=5,column=2,sticky="NSEW") trbutton_1.grid(row=2,column=3,sticky="NSEW") trbutton_2.grid(row=3,column=3,sticky="NSEW") smman.grid(row=3,column=0,sticky="NSEW") smauto.grid(row=4,column=0,sticky="NSEW") syst.grid(row=1,column=0,sticky="NSEW") weap.grid(row=1,column=1,sticky="NSEW") iff.grid(row=1,column=2,sticky="NSEW") test.grid(row=1,column=3,sticky="NSEW") target.grid(row=6,column=0,sticky="NSEW") spectral.grid(row=6,column=1,sticky="NSEW") ts.grid(row=6,column=2,columnspan=2,sticky="NSEW") # Execute tkinter root.mainloop() |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 7:20 pm ] |
Post subject: | |
I still have to work on button logic but this is as close as I can get on a resizable menu. The fire menu is also going to be fun to layout and add logic to. Will have to figure out how to get the gun selection triggering to work as well and I may have to deviate there on the form due to the way that python and windows treats keyboard input and sockets. Once I get it working on Windows I will hopefully have a test bed setup working to easily test on the raspberry pi and Linux. Code: # Import module
from tkinter import * import tkinter from PIL import Image, ImageTk import keyboard import pynput import pygame pygame.init() keys = pygame.key.get_pressed() # Create object root = tkinter.Tk() # Adjust size root.geometry("640x300") root.configure(bg='black') # Specify Grid # options for grid: # MINSIZE, PAD, UNIFORM, WEIGHT Grid.rowconfigure(root,0,weight=1, uniform='a') Grid.rowconfigure(root,1,weight=1, uniform='b') Grid.rowconfigure(root,2,weight=1, uniform='b') Grid.rowconfigure(root,3,weight=1, uniform='b') Grid.rowconfigure(root,4,weight=1, uniform='b') Grid.rowconfigure(root,5,weight=1, uniform='b') Grid.rowconfigure(root,6,weight=1, uniform='b') Grid.rowconfigure(root,7,weight=1, uniform='b') Grid.rowconfigure(root,8,weight=1, uniform='b') Grid.rowconfigure(root,9,weight=1, uniform='b') Grid.columnconfigure(root,0,weight=1, uniform='d') Grid.columnconfigure(root,1,weight=1, uniform='d') Grid.columnconfigure(root,2,weight=1, uniform='d') Grid.columnconfigure(root,3,weight=1, uniform='d') Grid.columnconfigure(root,4,weight=1, uniform='d') Grid.columnconfigure(root,5,weight=1, uniform='d') Grid.columnconfigure(root,6,weight=1, uniform='d') Grid.columnconfigure(root,7,weight=1, uniform='d') #Grid.columnconfigure(root,4,weight=1, uniform='a') #Grid.rowconfigure(root,0,row=0,weight=0) # notes on different widget options other notes sections will be added for late rreference needs and # desired customizations. # w = Canvas (master, option-value # bd, bg, cursor, highlight color, width, height # w = CheckButton(master, option=value) # Title, activebackground, activeforeground, bg, command, font, image # w=Entry(master, option=value) # bd, bg, cursor, command, highlightcolor, width, height # w=Label(master, option=value) # bg, bd, command, font, image, width, height # w = Listbox(master, option=value) # hightlightcolor, bg, bd, font, image, width, height # w = MenuButton(master, option=value) # activebackground, activeforeground, bg, bd, cursor, image, width, height, highlightcolor # w = Scrollbar(master, option=value) # width, activebackground, bg, bd, cursor # w = Text(master, option=value) # highlightcolor, insertbackground, bg, font, image, width, height # w = tk.menu button(parent, option, ...) # activebackground, activeforeground, anchor, background or bg, cursor, compound, direction, disabledforeground, fg, font, height, highlightbackground, highlightcolor, highlightthickness, image, justify, menu, padx, pady, relief, state, takefocus, text, textvariable, underline, width, wraplength # # # #image files #photo = PhotoImage(file = r"c:\Menu_title.png") # old sentry gun menu title # Specify Framesw = Frame(master, option=value) # bg, bd, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, width # Create Buttons # master, option=value, ... # activebackground, activeforeground, bd, bg, command, fg, font, height, highlightcolor, image, justify, padx, pady, relief, state, underline, width, wraplength button_1 = Button(root,justify=CENTER,text="AUTO-REMOTE",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') button_2 = Button(root,justify=CENTER,text="HARD",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') button_3 = Button(root,justify=CENTER,text="SEMIHARD",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') button_4 = Button(root,justify=CENTER,text="SOFT",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') sbutton_1 = Button(root,justify=CENTER,text="BIO",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') sbutton_2 = Button(root,justify=CENTER,text="INERT",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') tsbutton_1 = Button(root,justify=CENTER,text="MULTI SPEC",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') tsbutton_2 = Button(root,justify=CENTER,text="INFRA RED",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') tsbutton_3 = Button(root,justify=CENTER,text="UV",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') wsbutton_1 = Button(root,justify=CENTER,text="SAFE",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') wsbutton_2 = Button(root,justify=CENTER,text="ARMED",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') isbutton_1 = Button(root,justify=CENTER,text="SEARCH",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') isbutton_2 = Button(root,justify=CENTER,text="TEST",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') isbutton_3 = Button(root,justify=CENTER,text="ENGAGED",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') isbutton_4 = Button(root,justify=CENTER,text="INTERROGATE",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') trbutton_1 = Button(root,justify=CENTER,text="AUTO",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') trbutton_2 = Button(root,justify=CENTER,text="SELECTIVE",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') smman = Button(root,justify=CENTER,text="MAN-OVERRIDE",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') smauto = Button(root,justify=CENTER,text="SEMI-AUTO",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') gun_1 = Button(root,borderwidth=7,bg='black',relief=RIDGE,disabledforeground='yellow',state=DISABLED,text="kp") gun_2 = Button(root,borderwidth=7,bg='black',fg='yellow',disabledforeground='yellow',state=DISABLED,text="kp") #header = Button(root, image = photo, compound = TOP) # image reference headernew = Button(root, bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER, text="UA 571-C \n REMOTE SENTRY WEAPON SYSTEM") syst = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="SYSTEM \n MODE") weap = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="WEAPON \n STATUS") iff = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="IFF \n STATUS") test = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TEST \n ROUTINE") target = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TARGET PROFILE") spectral = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="SPECTRAL PROFILE") ts = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TARGET SELECT") # bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black' # Set grid # widget.grid(grid_options) # column, columnspan, ipadx, ipady, padx, pady, row, rowspan, sticky gun_1.grid(row=0,column=0,ipadx=2,ipady=2,padx=2,pady=2,sticky=W) gun_2.grid(row=0,column=7,ipadx=2,ipady=2,padx=2,pady=2,sticky=E) headernew.grid(row=0,column=1,columnspan=6,sticky="NSEW") button_1.grid(row=2,column=0,columnspan=2,sticky="NSEW") button_2.grid(row=9,column=0,columnspan=3,sticky="NSEW") button_3.grid(row=8,column=0,columnspan=3,sticky="NSEW") button_4.grid(row=7,column=0,columnspan=3,sticky="NSEW") sbutton_1.grid(row=7,column=3,columnspan=2,sticky="NSEW") sbutton_2.grid(row=8,column=3,columnspan=2,sticky="NSEW") tsbutton_1.grid(row=7,column=5,columnspan=3,sticky="NSEW") tsbutton_2.grid(row=8,column=5,columnspan=3,sticky="NSEW") tsbutton_3.grid(row=9,column=5,columnspan=3,sticky="NSEW") wsbutton_1.grid(row=2,column=2,columnspan=2,sticky="NSEW") wsbutton_2.grid(row=3,column=2,columnspan=2,sticky="NSEW") isbutton_1.grid(row=2,column=4,columnspan=2,sticky="NSEW") isbutton_2.grid(row=3,column=4,columnspan=2,sticky="NSEW") isbutton_3.grid(row=4,column=4,columnspan=2,sticky="NSEW") isbutton_4.grid(row=5,column=4,columnspan=2,sticky="NSEW") trbutton_1.grid(row=2,column=6,columnspan=2,sticky="NSEW") trbutton_2.grid(row=3,column=6,columnspan=2,sticky="NSEW") smman.grid(row=3,column=0,columnspan=2,sticky="NSEW") smauto.grid(row=4,column=0,columnspan=2,sticky="NSEW") syst.grid(row=1,column=0,columnspan=2,sticky="NSEW") weap.grid(row=1,column=2,columnspan=2,sticky="NSEW") iff.grid(row=1,column=4,columnspan=2,sticky="NSEW") test.grid(row=1,column=6,columnspan=2,sticky="NSEW") target.grid(row=6,column=0,columnspan=3,sticky="NSEW") spectral.grid(row=6,column=3,columnspan=2,sticky="NSEW") ts.grid(row=6,column=5,columnspan=3,sticky="NSEW") while True: # Execute tkinter root.mainloop() for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_q: pygame.quit() sys.exit(0) quit() break if keys[pygame.K_w]: break |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 7:22 pm ] |
Post subject: | |
I will also add that I am still working out the quit mechanism for windows. As it stand above code will have to be closed and then a ctrl+c used in the command window to kill it. killing via task manager is will also work. |
Author: | martinr1000 [ Sun Apr 04, 2021 7:39 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
this should do it. Escape key quit Code: running = True
while running: #process pygame events for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close running = False # Flag that we are done so we exit this loop pass if event.type == pygame.KEYDOWN: if event.key==pygame.K_ESCAPE: running = False |
Author: | martinr1000 [ Sun Apr 04, 2021 7:52 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
then pygame.quit() outside of the while loop |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 10:38 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
martinr1000 wrote: then pygame.quit() outside of the while loop That does not work properly under windows 10. Something about sockets and interrupts. Stuff put in to block malicious software from finding ways to take over and compromise the system. That should work fine under Linux and MacOS though. I just have to add code that windows will play nice with as the goal here is easier usage as we do not want to make things difficult. |
Author: | knoxvilles_joker [ Sun Apr 04, 2021 10:51 pm ] | ||
Post subject: | Re: idea on flash replacement for sentry gun terminal progra | ||
I got the formatting set on the fire screen I think. I just have to add logic. The font deal is something I will address later by building a custom font to match what the flash utility made manually. I was thinking of calling it alienslegacy font. as an fyi there are 100k plus unique fonts out there in the world wide web of things. Before designing a font I want to see if there is anything remotely close at this point. Complex pieces like this are best being done separately and then slowly integrated. I had to fight on a copy and paste error on this. I forgot to copy a ) and it broke the whole kitten caboodle. keyboard input and mouse click logic is going to be a bit fun. Code: # Import module
from tkinter import * import tkinter #from PIL import Image, ImageTk import pygame pygame.init() #rounds = ammocounter() #secsremain = seconds() # Create object root = tkinter.Tk() # Adjust size root.geometry("640x300") root.configure(bg='black') Grid.rowconfigure(root,0,weight=1, uniform='c') Grid.rowconfigure(root,1,weight=1, uniform='b') Grid.rowconfigure(root,2,weight=1, uniform='b') Grid.rowconfigure(root,3,weight=1, uniform='b') Grid.rowconfigure(root,4,weight=1, uniform='b') Grid.rowconfigure(root,5,weight=1, uniform='b') Grid.rowconfigure(root,6,weight=1, uniform='b') Grid.rowconfigure(root,7,weight=1, uniform='b') Grid.rowconfigure(root,8,weight=1, uniform='b') #Grid.rowconfigure(root,9,weight=1, uniform='b') Grid.columnconfigure(root,0,weight=1, uniform='a') Grid.columnconfigure(root,1,weight=1, uniform='a') Grid.columnconfigure(root,2,weight=1, uniform='a') Grid.columnconfigure(root,3,weight=1, uniform='a') Grid.columnconfigure(root,4,weight=1, uniform='a') Grid.columnconfigure(root,5,weight=1, uniform='a') #Grid.columnconfigure(root,6,weight=1, uniform='a') #Grid.columnconfigure(root,7,weight=1, uniform='a') gun_1 = Button(root, borderwidth=7,bg='black',fg='yellow',disabledforeground='yellow',state=DISABLED,text="kp") gun_2 = Button(root, borderwidth=7,bg='black',fg='yellow',disabledforeground='yellow',state=DISABLED,text="kp") headernew = Button(root, bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER, text="UA 571-C \n REMOTE SENTRY WEAPON SYSTEM") rm = Button(root,justify=CENTER,text="R(M)",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') temp = Button(root,justify=CENTER,text="Temp",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') rmbar = Button(root,justify=CENTER,text="R",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') tempbar = Button(root,justify=CENTER,text="T",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') timer = Button(root,justify=CENTER,text="secsremain",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') rounds = Button(root,justify=CENTER,text="rounds",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') crit = Button(root,justify=CENTER,text="CRITICAL",bg='black', fg='yellow', highlightbackground='yellow', highlightcolor='black',activebackground='yellow') roundsr = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="Rounds \n Remaining") timestat = Button(root,bg='black',state=DISABLED, fg='yellow',disabledforeground='yellow',highlightbackground='yellow',borderwidth=2,justify=CENTER,text="TIME AT 100% \n (secs)") gun_1.grid(row=0,column=0,columnspan=2,rowspan=2,sticky=NW) gun_2.grid(row=0,column=5,columnspan=2,rowspan=2,sticky=NE) headernew.grid(row=0,column=1,columnspan=4,rowspan=2,sticky="NSEW") tempbar.grid(row=3,column=4,rowspan=6,sticky="NSEW") rmbar.grid(row=3,column=5,rowspan=6,sticky="NSEW") rm.grid(row=2,column=5,sticky="NSEW") temp.grid(row=2,column=4,sticky="NSEW") timer.grid(row=7,column=2,columnspan=2,sticky="NS") rounds.grid(row=3,column=2,columnspan=2,sticky="NS") timestat.grid(row=7,column=0,columnspan=2,sticky="NSEW") crit.grid(row=5,column=0,columnspan=2,sticky="NSEW") roundsr.grid(row=3,column=0,columnspan=2,sticky="NS") # Execute tkinter running = True while running: root.mainloop() for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close running = False # Flag that we are done so we exit this loop pass if event.type == pygame.KEYDOWN: if event.key==pygame.K_q: running = False pygame.quit()
|
Author: | martinr1000 [ Sun Apr 04, 2021 11:19 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
knoxvilles_joker wrote: martinr1000 wrote: then pygame.quit() outside of the while loop That does not work properly under windows 10. Something about sockets and interrupts. Stuff put in to block malicious software from finding ways to take over and compromise the system. That should work fine under Linux and MacOS though. I just have to add code that windows will play nice with as the goal here is easier usage as we do not want to make things difficult. it's working on my windows 10 box bud. Not sure why it wouldn't on yours |
Author: | knoxvilles_joker [ Mon Apr 05, 2021 12:14 am ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
martinr1000 wrote: knoxvilles_joker wrote: martinr1000 wrote: then pygame.quit() outside of the while loop That does not work properly under windows 10. Something about sockets and interrupts. Stuff put in to block malicious software from finding ways to take over and compromise the system. That should work fine under Linux and MacOS though. I just have to add code that windows will play nice with as the goal here is easier usage as we do not want to make things difficult. it's working on my windows 10 box bud. Not sure why it wouldn't on yours I added a quit button and that seemed to do the trick: quit = Button(root, bg='black', fg='yellow', text='q', command=root.quit) quit.grid(row=8,column=0,sticky="SW") I can change foreground and background options to make it invisible. On the other window I just activated the header and made it quit if clicked. I suspect my issue is due to security with the script not running right. THis is not a bad problem in the development phase, it allows me to code for possible issues encountered. I just have to write a couple of variants of this program, the mouse driven one will be more for smart devices and gui based OS, I will have to write a separate keyboard driven one for our alternate setups. |
Author: | knoxvilles_joker [ Mon Apr 05, 2021 2:55 am ] |
Post subject: | |
I am working on the ammo count down now. I am not getting much progress. I have found that I have to use a label and use a .get() call to get the current ammo count. I am suspecting though that some of my problems are computer related. the tkinter Label feature allows use of a textvariable flag that you can use to dynamically display counts. |
Author: | martinr1000 [ Wed Apr 07, 2021 7:27 pm ] |
Post subject: | |
Hi, spent a bit of time trying to make up a font that is close to that of the sentry terminal. Think it needs some tweaking but here is the first test version. I'm not done yet as i need to do the lower case characters. I also need everyone's opinion regarding which version to stick with because I have a smooth version and a jagged version. See pics. Attachment: smooth Attachment: jagged |
Author: | martinr1000 [ Wed Apr 07, 2021 7:32 pm ] |
Post subject: | Re: idea on flash replacement for sentry gun terminal progra |
Also i was reading that the max resolution of the gridcase could be 640x400 because of dual scan. Wondering if this is possible and whether or not it would make more sense in terms of the proportions of the terminal software that we see. 640x200 looks a bit thin to me but i am no expert in this area. (the pics above are based on 640x400) cheers |
Author: | knoxvilles_joker [ Thu Apr 08, 2021 12:49 am ] |
Post subject: | |
The key is to have the window so it is resizable so we can use the thing as a main attraction at our fan table with all of the hacked grid case setups we have out there now amongst our group. |
Page 1 of 3 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |