1

My problem is somewhere within my code but I cannot find where, the problem is when I push one of the buttons the xterm window intergrated within the program resizes between two buttons (which's space is tiny)

import Tkinter
from Tkinter import *
import subprocess
import os
from os import system as cmd



def test():
    os.system('sudo xterm -into %d -geometry 200x40 -sb -e overscan &' % wid)

def sysinfo():
    os.system('xterm -into %d  -sb -e systeminfo &' % wid)

def ipconf():
    os.system('xterm -into %d -sb -e ipconfig &' % wid)

def grpmw():
    os.system('xterm -into %d -geometry 0x0 -sb -e firefox -height 900 -width 1440 *snip*' % wid)

def lout():
    os.system('xterm -into %d -sb -e pkill python' % wid)

def rboot():
    os.system('xterm -into %d -sb -e sudo reboot' % wid)

def pwoff():
    os.system('xterm -into %d -sb -e sudo poweroff' % wid)


WINDOW_SIZE = "1440x900"
top = Tkinter.Tk()
top.geometry(WINDOW_SIZE)

Button1  = Tkinter.Button(top, text ="Systeem informatie opvragen", command=sysinfo)
Button1.pack(side=LEFT,  anchor=NW)

Button2  = Tkinter.Button(top, text ="IP adres achterhalen",        command=ipconf)
Button2.pack(side=LEFT,  anchor=NW)

Button3  = Tkinter.Button(top, text ="Zwarte balken weghalen",      command=test)
Button3.pack(side=RIGHT, anchor=N )

Button4  = Tkinter.Button(top, text = "21 Groep Myworkplace",       command = grpmw)
Button4.pack(side=RIGHT, anchor=N )

Button6  = Tkinter.Label(top, text = "                                                    ")
Button6.pack(side=RIGHT, anchor=N )

Button5  = Tkinter.Button(top, text = "Uitloggen", command = lout)
Button5.pack(side=RIGHT, anchor=N )

Button7  = Tkinter.Label(top, text = "                                      ")
Button7.pack(side=LEFT,  anchor=N )

Button8  = Tkinter.Button(top, text = "Herstarten", command = rboot)
Button8.pack(side=LEFT,  anchor=N )

Button9  = Tkinter.Button(top, text = "Afsluiten", command = pwoff)
Button9.pack(                     )

termf = Frame(top, height=1000, width=1000)

termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()

def send_entry_to_terminal(*args):
    """*args needed since callback may be called from no arg (button)
   or one arg (entry)
   """
    cmd("%s" % (BasicCovTests))


if __name__ == "__main__":
     top.title('KEUZE MENU')
     top.mainloop()

------------------edit 1------------------

I noticed my post was unclear, I apologize, this is what I mean. Somehow when I press one of the buttons it gets stuck between the edges of the 'afsluiten' button.

But when I remove the labels the frame resizes to a more workable size like seen on this screenshot

------------------edit 2------------------

Soo... I think I got it working, I don't know for sure because I have a black screen, I found out that when you use lets say side=LEFT twice it blocks the left side of the screen from start of the first button to the end of the second button, making that whole area unusable, so I used grid, problem is the terminal goes off-screen, so I made a child using pack, and now I have a black screen, hahaha, ill keep you guys updated

patrick
  • 573

0 Answers0