Tkinter display goes outside of the screen
up vote
-1
down vote
favorite
When creating A Gui with Tkinter using lots of images cause the window to be larger than the screen how do I stop this?
when running the code the tkinter window displays like this:
screen shot of tkinter window that is displayed
import time
from tkinter import *
class App:
def __init__(self,master):
#setting frames
self.master=master
speeddisp=Frame(master)
speeddisp.grid(row=1, column=2)
clockdisp=Frame(master)
clockdisp.grid(row=0,column=0)
indicatorhazard=Frame(master)
indicatorhazard.grid(row=0, column=2)
datedisp=Frame(master)
datedisp.grid(row=0, column=3)
lightdisp=Frame(master)
lightdisp.grid(row=1,column=0)
fandisp=Frame(master)
fandisp.grid(row=1,column=0)
tempdisp=Frame(master)
tempdisp.grid(row=3,column=2)
#setting photos in Photoimage class from TK
self.left_indicator_on_img=PhotoImage(file="left on.gif")
self.left_indicator_off_img=PhotoImage(file="left off.gif")
self.right_indicator_on_img=PhotoImage(file="right on.gif")
self.right_indicator_off_img=PhotoImage(file="right off.gif")
self.hazard_off_img=PhotoImage(file="hazard off.gif")
self.hazard_on_img=PhotoImage(file="hazard on.gif")
self.light_on_img=PhotoImage(file="light on.gif")
self.light_off_img=PhotoImage(file="light off.gif")
self.fan_on_img=PhotoImage(file="fanimg on.gif")
self.fan_off_img=PhotoImage(file="fanimg off.gif")
#defining and placing labels
self.speedlbl=Label(speeddisp, text=('00.00MPH'), font=("Helvetica", 110))
self.speedlbl.grid(row=0,column=0)
self.clocklbl=Label(clockdisp, text=(time.gmtime()[3],":",time.gmtime()[4]))
self.clocklbl.grid(row=0,column=0)
self.leftindicator=Label(indicatorhazard,image=self.left_indicator_off_img)
self.leftindicator.grid(row=0,column=0)
self.rightindicator=Label(indicatorhazard,image=self.right_indicator_off_img)
self.rightindicator.grid(row=0,column=1)
self.hazardindicator=Label(indicatorhazard,image=self.hazard_off_img)
self.hazardindicator.grid(row=0,column=2)
self.datedisplay=Label(datedisp, text=(time.gmtime()[2],"/",time.gmtime()[1],"/",time.gmtime()[0]))
self.datedisplay.grid(row=0,column=0)
self.lights=Button(lightdisp, image=self.light_off_img)
self.lights.grid(row=0,column=0)
self.fanimg=Label(fandisp, image=self.fan_off_img)
self.fanimg.grid(row=0, column=0)
self.temptxt=Label(tempdisp,text='00.00c', font=("Helvetica", 50))
self.temptxt.grid(row=0, column=0)
python-3.x tkinter
add a comment |
up vote
-1
down vote
favorite
When creating A Gui with Tkinter using lots of images cause the window to be larger than the screen how do I stop this?
when running the code the tkinter window displays like this:
screen shot of tkinter window that is displayed
import time
from tkinter import *
class App:
def __init__(self,master):
#setting frames
self.master=master
speeddisp=Frame(master)
speeddisp.grid(row=1, column=2)
clockdisp=Frame(master)
clockdisp.grid(row=0,column=0)
indicatorhazard=Frame(master)
indicatorhazard.grid(row=0, column=2)
datedisp=Frame(master)
datedisp.grid(row=0, column=3)
lightdisp=Frame(master)
lightdisp.grid(row=1,column=0)
fandisp=Frame(master)
fandisp.grid(row=1,column=0)
tempdisp=Frame(master)
tempdisp.grid(row=3,column=2)
#setting photos in Photoimage class from TK
self.left_indicator_on_img=PhotoImage(file="left on.gif")
self.left_indicator_off_img=PhotoImage(file="left off.gif")
self.right_indicator_on_img=PhotoImage(file="right on.gif")
self.right_indicator_off_img=PhotoImage(file="right off.gif")
self.hazard_off_img=PhotoImage(file="hazard off.gif")
self.hazard_on_img=PhotoImage(file="hazard on.gif")
self.light_on_img=PhotoImage(file="light on.gif")
self.light_off_img=PhotoImage(file="light off.gif")
self.fan_on_img=PhotoImage(file="fanimg on.gif")
self.fan_off_img=PhotoImage(file="fanimg off.gif")
#defining and placing labels
self.speedlbl=Label(speeddisp, text=('00.00MPH'), font=("Helvetica", 110))
self.speedlbl.grid(row=0,column=0)
self.clocklbl=Label(clockdisp, text=(time.gmtime()[3],":",time.gmtime()[4]))
self.clocklbl.grid(row=0,column=0)
self.leftindicator=Label(indicatorhazard,image=self.left_indicator_off_img)
self.leftindicator.grid(row=0,column=0)
self.rightindicator=Label(indicatorhazard,image=self.right_indicator_off_img)
self.rightindicator.grid(row=0,column=1)
self.hazardindicator=Label(indicatorhazard,image=self.hazard_off_img)
self.hazardindicator.grid(row=0,column=2)
self.datedisplay=Label(datedisp, text=(time.gmtime()[2],"/",time.gmtime()[1],"/",time.gmtime()[0]))
self.datedisplay.grid(row=0,column=0)
self.lights=Button(lightdisp, image=self.light_off_img)
self.lights.grid(row=0,column=0)
self.fanimg=Label(fandisp, image=self.fan_off_img)
self.fanimg.grid(row=0, column=0)
self.temptxt=Label(tempdisp,text='00.00c', font=("Helvetica", 50))
self.temptxt.grid(row=0, column=0)
python-3.x tkinter
1
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
When creating A Gui with Tkinter using lots of images cause the window to be larger than the screen how do I stop this?
when running the code the tkinter window displays like this:
screen shot of tkinter window that is displayed
import time
from tkinter import *
class App:
def __init__(self,master):
#setting frames
self.master=master
speeddisp=Frame(master)
speeddisp.grid(row=1, column=2)
clockdisp=Frame(master)
clockdisp.grid(row=0,column=0)
indicatorhazard=Frame(master)
indicatorhazard.grid(row=0, column=2)
datedisp=Frame(master)
datedisp.grid(row=0, column=3)
lightdisp=Frame(master)
lightdisp.grid(row=1,column=0)
fandisp=Frame(master)
fandisp.grid(row=1,column=0)
tempdisp=Frame(master)
tempdisp.grid(row=3,column=2)
#setting photos in Photoimage class from TK
self.left_indicator_on_img=PhotoImage(file="left on.gif")
self.left_indicator_off_img=PhotoImage(file="left off.gif")
self.right_indicator_on_img=PhotoImage(file="right on.gif")
self.right_indicator_off_img=PhotoImage(file="right off.gif")
self.hazard_off_img=PhotoImage(file="hazard off.gif")
self.hazard_on_img=PhotoImage(file="hazard on.gif")
self.light_on_img=PhotoImage(file="light on.gif")
self.light_off_img=PhotoImage(file="light off.gif")
self.fan_on_img=PhotoImage(file="fanimg on.gif")
self.fan_off_img=PhotoImage(file="fanimg off.gif")
#defining and placing labels
self.speedlbl=Label(speeddisp, text=('00.00MPH'), font=("Helvetica", 110))
self.speedlbl.grid(row=0,column=0)
self.clocklbl=Label(clockdisp, text=(time.gmtime()[3],":",time.gmtime()[4]))
self.clocklbl.grid(row=0,column=0)
self.leftindicator=Label(indicatorhazard,image=self.left_indicator_off_img)
self.leftindicator.grid(row=0,column=0)
self.rightindicator=Label(indicatorhazard,image=self.right_indicator_off_img)
self.rightindicator.grid(row=0,column=1)
self.hazardindicator=Label(indicatorhazard,image=self.hazard_off_img)
self.hazardindicator.grid(row=0,column=2)
self.datedisplay=Label(datedisp, text=(time.gmtime()[2],"/",time.gmtime()[1],"/",time.gmtime()[0]))
self.datedisplay.grid(row=0,column=0)
self.lights=Button(lightdisp, image=self.light_off_img)
self.lights.grid(row=0,column=0)
self.fanimg=Label(fandisp, image=self.fan_off_img)
self.fanimg.grid(row=0, column=0)
self.temptxt=Label(tempdisp,text='00.00c', font=("Helvetica", 50))
self.temptxt.grid(row=0, column=0)
python-3.x tkinter
When creating A Gui with Tkinter using lots of images cause the window to be larger than the screen how do I stop this?
when running the code the tkinter window displays like this:
screen shot of tkinter window that is displayed
import time
from tkinter import *
class App:
def __init__(self,master):
#setting frames
self.master=master
speeddisp=Frame(master)
speeddisp.grid(row=1, column=2)
clockdisp=Frame(master)
clockdisp.grid(row=0,column=0)
indicatorhazard=Frame(master)
indicatorhazard.grid(row=0, column=2)
datedisp=Frame(master)
datedisp.grid(row=0, column=3)
lightdisp=Frame(master)
lightdisp.grid(row=1,column=0)
fandisp=Frame(master)
fandisp.grid(row=1,column=0)
tempdisp=Frame(master)
tempdisp.grid(row=3,column=2)
#setting photos in Photoimage class from TK
self.left_indicator_on_img=PhotoImage(file="left on.gif")
self.left_indicator_off_img=PhotoImage(file="left off.gif")
self.right_indicator_on_img=PhotoImage(file="right on.gif")
self.right_indicator_off_img=PhotoImage(file="right off.gif")
self.hazard_off_img=PhotoImage(file="hazard off.gif")
self.hazard_on_img=PhotoImage(file="hazard on.gif")
self.light_on_img=PhotoImage(file="light on.gif")
self.light_off_img=PhotoImage(file="light off.gif")
self.fan_on_img=PhotoImage(file="fanimg on.gif")
self.fan_off_img=PhotoImage(file="fanimg off.gif")
#defining and placing labels
self.speedlbl=Label(speeddisp, text=('00.00MPH'), font=("Helvetica", 110))
self.speedlbl.grid(row=0,column=0)
self.clocklbl=Label(clockdisp, text=(time.gmtime()[3],":",time.gmtime()[4]))
self.clocklbl.grid(row=0,column=0)
self.leftindicator=Label(indicatorhazard,image=self.left_indicator_off_img)
self.leftindicator.grid(row=0,column=0)
self.rightindicator=Label(indicatorhazard,image=self.right_indicator_off_img)
self.rightindicator.grid(row=0,column=1)
self.hazardindicator=Label(indicatorhazard,image=self.hazard_off_img)
self.hazardindicator.grid(row=0,column=2)
self.datedisplay=Label(datedisp, text=(time.gmtime()[2],"/",time.gmtime()[1],"/",time.gmtime()[0]))
self.datedisplay.grid(row=0,column=0)
self.lights=Button(lightdisp, image=self.light_off_img)
self.lights.grid(row=0,column=0)
self.fanimg=Label(fandisp, image=self.fan_off_img)
self.fanimg.grid(row=0, column=0)
self.temptxt=Label(tempdisp,text='00.00c', font=("Helvetica", 50))
self.temptxt.grid(row=0, column=0)
python-3.x tkinter
python-3.x tkinter
asked Nov 10 at 16:25
James Hare
12
12
1
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35
add a comment |
1
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35
1
1
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You should either crop the image using a photo editor so that the image is small enough to fit inside the window or run this code in python to make the tkinter window bigger:
self.master.geometry("1000x1000")
inside
__init__
and the
"1000x1000"
is x pixels by y pixels.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You should either crop the image using a photo editor so that the image is small enough to fit inside the window or run this code in python to make the tkinter window bigger:
self.master.geometry("1000x1000")
inside
__init__
and the
"1000x1000"
is x pixels by y pixels.
add a comment |
up vote
0
down vote
You should either crop the image using a photo editor so that the image is small enough to fit inside the window or run this code in python to make the tkinter window bigger:
self.master.geometry("1000x1000")
inside
__init__
and the
"1000x1000"
is x pixels by y pixels.
add a comment |
up vote
0
down vote
up vote
0
down vote
You should either crop the image using a photo editor so that the image is small enough to fit inside the window or run this code in python to make the tkinter window bigger:
self.master.geometry("1000x1000")
inside
__init__
and the
"1000x1000"
is x pixels by y pixels.
You should either crop the image using a photo editor so that the image is small enough to fit inside the window or run this code in python to make the tkinter window bigger:
self.master.geometry("1000x1000")
inside
__init__
and the
"1000x1000"
is x pixels by y pixels.
answered Nov 11 at 20:27
CME1 Crewmember
13
13
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240956%2ftkinter-display-goes-outside-of-the-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What do you want it to do when the image is too large to fit? Refuse to display it? Shrink the image? Crop the image? scroll the image? Something else?
– Bryan Oakley
Nov 10 at 16:35