-
Hi, I have two questions :
I'm able to make the following layout :
with the following code : import pytermgui as ptg
def create_layout():
layout = ptg.Layout()
layout.add_slot("slot1", height=0.5)
layout.add_slot("slot2", width=0.5, height=0.5)
layout.add_break()
layout.add_slot("slot3")
return layout
def main():
with ptg.WindowManager() as manager:
manager.layout = create_layout()
manager.add(ptg.Window("1"), assign="slot1")
manager.add(ptg.Window("2"), assign="slot2")
manager.add(ptg.Window("3"), assign="slot3")
if __name__ == "__main__":
main()
import pytermgui as ptg
YELLOW = "#ffff00"
BLUE = "#0000ff"
def main():
layout = ptg.Layout()
layout.add_slot("slot1")
layout.add_slot("slot2", width=0.5)
with ptg.WindowManager() as manager:
manager.layout = layout
window1 = ptg.Window("1", box="ROUNDED")
window1.styles.border__corner = BLUE
window2 = ptg.Window("2", box="ROUNDED")
window2.styles.border__corner = YELLOW
manager.add(window1, assign="slot1")
manager.add(window2, assign="slot2")
if __name__ == "__main__":
main() Here I tried also : import pytermgui as ptg
YELLOW = "#ffff00"
BLUE = "#0000ff"
def main():
layout = ptg.Layout()
layout.add_slot("slot1")
layout.add_slot("slot2", width=0.5)
with ptg.WindowManager() as manager:
manager.layout = layout
window1 = ptg.Window("1", box="ROUNDED")
window1.styles.border = BLUE
window1.styles.border_focused = BLUE
window1.styles.corner = BLUE
window1.styles.corner_focused = BLUE
window2 = ptg.Window("2", box="ROUNDED")
window2.styles.border = YELLOW
window2.styles.border_focused = YELLOW
window2.styles.corner = YELLOW
window2.styles.corner_focused = YELLOW
manager.add(window1, assign="slot1")
manager.add(window2, assign="slot2")
if __name__ == "__main__":
main() But here, only |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
For my second question, I found out that import pytermgui as ptg
YELLOW = "#ffff00"
BLUE = "#0000ff"
def main():
layout = ptg.Layout()
layout.add_slot("slot1")
layout.add_slot("slot2", width=0.5)
with ptg.WindowManager() as manager:
manager.layout = layout
window1 = ptg.Window("1", box="ROUNDED")
window1.styles.border = BLUE
window1.styles.border_focused = YELLOW
window1.styles.border_blurred = BLUE
window1.styles.corner = BLUE
window1.styles.corner_focused = YELLOW
window1.styles.corner_blurred = BLUE
window2 = ptg.Window("2", box="ROUNDED")
window2.styles.border = BLUE
window2.styles.border_focused = YELLOW
window2.styles.border_blurred = BLUE
window2.styles.corner = BLUE
window2.styles.corner_focused = YELLOW
window2.styles.corner_blurred = BLUE
manager.add(window1, assign="slot1")
manager.add(window2, assign="slot2")
if __name__ == "__main__":
main() Then focused window is in yellow and unfocused window is in blue, in this example. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately this layout would require nested layouts which aren't supported. I made it work for celadon, but it just wasn't economical for this codebase :( |
Beta Was this translation helpful? Give feedback.
Unfortunately this layout would require nested layouts which aren't supported. I made it work for celadon, but it just wasn't economical for this codebase :(