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)









share|improve this question


















  • 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















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)









share|improve this question


















  • 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













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)









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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














  • 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












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.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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.






    share|improve this answer

























      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.






      share|improve this answer























        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 20:27









        CME1 Crewmember

        13




        13






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma