2014-10-09 2 views
9

는 내가 전화 할 때, 내 PC에 연결된 보조 디스플레이에 내 응용 프로그램의 창을 이동하는 경우에도 "주"디스플레이에서 전체 화면 창을 만들지 만,하는 방법을 알고 :tkinter를 사용하여 2 차 디스플레이에서 전체 화면을 만드는 방법은 무엇입니까?

self.master.attributes('-fullscreen', True) 

그 창을 전체 화면으로, 그것을 "메인"디스플레이에서 나타나고 보조 디스플레이에서는 나타나지 않습니다 (앱의 윈도우는 보조 디스플레이에서 사라지고 "메인"디스플레이에 즉시 전체 화면으로 나타납니다).

어떻게 보조 디스플레이에서 전체 화면으로 만들 수 있습니까?

+0

Windows? 또는 다른 것? –

+0

그냥 Windows ... Tk() 또는 Toplevel() –

+0

글쎄, 내 대답은 조금 명확하지 않은 것 같아 @TerryJanReedy. Windows에서 Tk() 또는 Toplevel() 창을 전체 화면으로 표시하려고합니다. –

답변

4

이 윈도우 7에서 작동 : 두 번째 화면의 폭과 높이가 첫 번째와 같은 경우, 당신은 그것의 상대적 위치를 따라 다음 코드 win1 또는 WIN2 형상을 사용할 수 있습니다 (왼쪽 또는 오른쪽)을 사용하여 보조 디스플레이에 전체 화면을 표시합니다.

from Tkinter import * 

def create_win(): 
    def close(): win1.destroy();win2.destroy() 
    win1 = Toplevel() 
    win1.geometry('%dx%d%+d+%d'%(sw,sh,-sw,0)) 
    Button(win1,text="Exit1",command=close).pack() 
    win2 = Toplevel() 
    win2.geometry('%dx%d%+d+%d'%(sw,sh,sw,0)) 
    Button(win2,text="Exit2",command=close).pack() 

root=Tk() 
sw,sh = root.winfo_screenwidth(),root.winfo_screenheight() 
print "screen1:",sw,sh 
w,h = 800,600 
a,b = (sw-w)/2,(sh-h)/2 

Button(root,text="Exit",command=lambda r=root:r.destroy()).pack() 
Button(root,text="Create win2",command=create_win).pack() 

root.geometry('%sx%s+%s+%s'%(w,h,a,b)) 
root.mainloop() 
+0

해결 방법이 있지만 누군가에게 유용 할 수 있기 때문에 "수락"및 이에 대한 upvote가 필요합니다. 감사합니다. –

1

시도 :

from Tkinter import * 

rot = Tk() 


wth,hgh = rot.winfo_screenwidth(),rot.winfo_screenheight() 
#take desktop width and hight (pixel) 
_w,_h = 800,600 #root width and hight 
a,b = (wth-_w)/2,(hgh-_h)/2 #Put root to center of display(Margin_left,Margin_top) 



def spann(): 
    def _exit(): 
     da.destroy() 

    da = Toplevel() 
    da.geometry('%dx%d+%d+%d' % (wth, hgh,0, 0)) 

    Button(da,text="Exit",command=_exit).pack() 
    da.overrideredirect(1) 
    da.focus_set()#Restricted access main menu 




Button(rot,text="Exit",command=lambda rot=rot : rot.destroy()).pack() 


but = Button(rot,text="Show SUB",command=spann) 
but.pack() 


rot.geometry('%sx%s+%s+%s'%(_w,_h,a,b)) 
rot.mainloop() 
""" Geometry pattern 'WxH+a+b' 
     W = Width 
     H = Height 
     a = Margin_left+Margin_Top"""