tkinter resize and reposition unintentionally

Multi tool use
How to fix the size and position of a Label and Image in tkinter?
I have uploaded the code in raspberry pi 0 and it displays in the exact size and position. Days pass, the Image become bigger or smaller and also the Label. Can someone help me?
import tkinter
from tkinter import *
import paho.mqtt.client as mqtt
import json
from PIL import Image, ImageTk
import time
import datetime
root = tkinter.Tk()
def close_escape(event=None):
print("n ESCAPED")
root.destroy()
root.overrideredirect(True)
root.overrideredirect(False)
#root.attributes("-fullscreen", True)
root.geometry("600x500")
root.resizable(False, False)
root.wm_attributes("-topmost", 1)
root.focus_set()
root.bind("<Escape>", close_escape)
#### header
wid=200;hei=90
logo = Image.open('logo.png')
logo = logo.resize((wid, hei), Image.ANTIALIAS)
l = ImageTk.PhotoImage(logo)
panel = tkinter.Label(root, image=l)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=1,y=0)
##body
wid=200;hei=200
im_temp = Image.open('user.png')
im_temp = im_temp.resize((wid, hei), Image.ANTIALIAS)
img = ImageTk.PhotoImage(im_temp)
panel = tkinter.Label(root, image=img)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=60,y=150)
name= Label(root, text='Name:', font='Tahoma 14')
name.place(x=290, y=165)
nID= Label(root, text='ID Number:', font='Tahoma 14')
nID.place(x=290, y=265)
usrnme = Label(root, font="Georgia 35")
usrnme['text'] = "Full Name"
usrnme.place(x=330,y=195)
idnum = Label(root, font="Tahoma 25")
idnum['text'] = "ID Number"
idnum.place(x=330,y=300)
python-3.x user-interface tkinter raspberry-pi
add a comment |
How to fix the size and position of a Label and Image in tkinter?
I have uploaded the code in raspberry pi 0 and it displays in the exact size and position. Days pass, the Image become bigger or smaller and also the Label. Can someone help me?
import tkinter
from tkinter import *
import paho.mqtt.client as mqtt
import json
from PIL import Image, ImageTk
import time
import datetime
root = tkinter.Tk()
def close_escape(event=None):
print("n ESCAPED")
root.destroy()
root.overrideredirect(True)
root.overrideredirect(False)
#root.attributes("-fullscreen", True)
root.geometry("600x500")
root.resizable(False, False)
root.wm_attributes("-topmost", 1)
root.focus_set()
root.bind("<Escape>", close_escape)
#### header
wid=200;hei=90
logo = Image.open('logo.png')
logo = logo.resize((wid, hei), Image.ANTIALIAS)
l = ImageTk.PhotoImage(logo)
panel = tkinter.Label(root, image=l)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=1,y=0)
##body
wid=200;hei=200
im_temp = Image.open('user.png')
im_temp = im_temp.resize((wid, hei), Image.ANTIALIAS)
img = ImageTk.PhotoImage(im_temp)
panel = tkinter.Label(root, image=img)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=60,y=150)
name= Label(root, text='Name:', font='Tahoma 14')
name.place(x=290, y=165)
nID= Label(root, text='ID Number:', font='Tahoma 14')
nID.place(x=290, y=265)
usrnme = Label(root, font="Georgia 35")
usrnme['text'] = "Full Name"
usrnme.place(x=330,y=195)
idnum = Label(root, font="Tahoma 25")
idnum['text'] = "ID Number"
idnum.place(x=330,y=300)
python-3.x user-interface tkinter raspberry-pi
add a comment |
How to fix the size and position of a Label and Image in tkinter?
I have uploaded the code in raspberry pi 0 and it displays in the exact size and position. Days pass, the Image become bigger or smaller and also the Label. Can someone help me?
import tkinter
from tkinter import *
import paho.mqtt.client as mqtt
import json
from PIL import Image, ImageTk
import time
import datetime
root = tkinter.Tk()
def close_escape(event=None):
print("n ESCAPED")
root.destroy()
root.overrideredirect(True)
root.overrideredirect(False)
#root.attributes("-fullscreen", True)
root.geometry("600x500")
root.resizable(False, False)
root.wm_attributes("-topmost", 1)
root.focus_set()
root.bind("<Escape>", close_escape)
#### header
wid=200;hei=90
logo = Image.open('logo.png')
logo = logo.resize((wid, hei), Image.ANTIALIAS)
l = ImageTk.PhotoImage(logo)
panel = tkinter.Label(root, image=l)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=1,y=0)
##body
wid=200;hei=200
im_temp = Image.open('user.png')
im_temp = im_temp.resize((wid, hei), Image.ANTIALIAS)
img = ImageTk.PhotoImage(im_temp)
panel = tkinter.Label(root, image=img)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=60,y=150)
name= Label(root, text='Name:', font='Tahoma 14')
name.place(x=290, y=165)
nID= Label(root, text='ID Number:', font='Tahoma 14')
nID.place(x=290, y=265)
usrnme = Label(root, font="Georgia 35")
usrnme['text'] = "Full Name"
usrnme.place(x=330,y=195)
idnum = Label(root, font="Tahoma 25")
idnum['text'] = "ID Number"
idnum.place(x=330,y=300)
python-3.x user-interface tkinter raspberry-pi
How to fix the size and position of a Label and Image in tkinter?
I have uploaded the code in raspberry pi 0 and it displays in the exact size and position. Days pass, the Image become bigger or smaller and also the Label. Can someone help me?
import tkinter
from tkinter import *
import paho.mqtt.client as mqtt
import json
from PIL import Image, ImageTk
import time
import datetime
root = tkinter.Tk()
def close_escape(event=None):
print("n ESCAPED")
root.destroy()
root.overrideredirect(True)
root.overrideredirect(False)
#root.attributes("-fullscreen", True)
root.geometry("600x500")
root.resizable(False, False)
root.wm_attributes("-topmost", 1)
root.focus_set()
root.bind("<Escape>", close_escape)
#### header
wid=200;hei=90
logo = Image.open('logo.png')
logo = logo.resize((wid, hei), Image.ANTIALIAS)
l = ImageTk.PhotoImage(logo)
panel = tkinter.Label(root, image=l)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=1,y=0)
##body
wid=200;hei=200
im_temp = Image.open('user.png')
im_temp = im_temp.resize((wid, hei), Image.ANTIALIAS)
img = ImageTk.PhotoImage(im_temp)
panel = tkinter.Label(root, image=img)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=60,y=150)
name= Label(root, text='Name:', font='Tahoma 14')
name.place(x=290, y=165)
nID= Label(root, text='ID Number:', font='Tahoma 14')
nID.place(x=290, y=265)
usrnme = Label(root, font="Georgia 35")
usrnme['text'] = "Full Name"
usrnme.place(x=330,y=195)
idnum = Label(root, font="Tahoma 25")
idnum['text'] = "ID Number"
idnum.place(x=330,y=300)
python-3.x user-interface tkinter raspberry-pi
python-3.x user-interface tkinter raspberry-pi
edited Jan 3 at 21:41
Bryan Oakley
220k22274434
220k22274434
asked Jan 3 at 4:00


shielashiela
117
117
add a comment |
add a comment |
0
active
oldest
votes
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2f54016176%2ftkinter-resize-and-reposition-unintentionally%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f54016176%2ftkinter-resize-and-reposition-unintentionally%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
wAxnNNkrKdSuF3kriV AFtm2yA3F2h7bv9U3pq8,JcIX