I would like to explicitly set the terminal size. Is there a cross-platform way to do this? I want to make a game, showing fixed-sized art.
Asked
Active
Viewed 609 times
0
-
2http://stackoverflow.com/questions/6418678/resize-the-terminal-with-python – Shashank Sep 14 '13 at 17:01
-
Cross-platform? Likely not. What is your use case? – Steven Rumbalski Sep 14 '13 at 17:12
-
a game in terminal using ASCII art. Is that even possible? – ClawOfLight Sep 14 '13 at 17:32
-
I don't know. Why not use a Tkinter text frame set to a fixed width font? – Steven Rumbalski Sep 14 '13 at 17:55
-
Right, I hadn't thought of that at all! I'm still a noob ;) Thanks, I'll try that out when I have time! – ClawOfLight Sep 14 '13 at 18:47
1 Answers
0
I used Tkinter (Thanks Steven Rumbalski!), because I don't mind using GUI if it's cross-platform. Basically, I set a window geometry and the size of my "art" label:
from Tkinter import *
#Assign a variable to the shown image to be able to change it
displayed_image = "test.gif"
class App:
def __init__(self, master):
#Make a frame to enclose the art with a relief
self.topframe = Frame(master, borderwidth=5, pady=5, relief=RIDGE)
#Pack the frame to draw it
self.topframe.pack()
#This frame will contain the prompt
self.frame = Frame(master)
self.frame.pack()
photo = PhotoImage(file="../Art/"+displayed_image)
art = Label(self.topframe, width=1280, height=720, image=photo)
art.photo = photo
art.pack()
prompt = Entry(self.frame, width=1280)
prompt.pack()
root = Tk()
root.wm_geometry("%dx%d" % (1300, 780))
app = App(root)
root.mainloop()
root.destroy()

ClawOfLight
- 1
- 1