hello everybody , good day , i just need to insert an image : "BosqueTK.jpg" in a speciale place in my window Tkinter using .place(x= , y= ) , for this i created a frame f2 placed like :
f2.place(x=130 , y=213)
, and want to insert in it the picture : "BosqueTK.jpg" , thank you very much , this is all my code :
#! /usr/bin/python
#-*- coding:Utf-8-*-
# -*- coding: cp1252 -*-
import Tkinter as tk
import ttk
from Tkinter import *
import Image
import ImageTk
import os
def center(window):
sw = window.winfo_screenwidth()
sh = window.winfo_screenheight()
rw = window.winfo_reqwidth()
rh = window.winfo_reqheight()
xc = (sw - rw) / 2
yc = (sh -rh) / 2
window.geometry("+%d+%d" % (xc, yc))
window.deiconify()
def affichimg():
fenetre=Tk()
fenetre.geometry("700x400")
fenetre.title(' Test Data')
firstnamevar = StringVar()
lastnamevar = StringVar()
Phonevar = IntVar()
f1 = Frame(fenetre, bg="#290080", width=500, height=500)
f1.pack( fill=X, expand=0)
f2 = Frame(fenetre, bg="white", width=215, height=135)
f2.place(x=130 , y=213)
lab1 = Label(fenetre, text="Voila la table testtable de la base testbase" , bg = "#290080", fg = "white" )
lab1.place ( x=100 , y=15 )
lab2 = Label(fenetre, text="Prénom" , bg = "#290080", fg = "white" )
lab2.place ( x=30 , y=100 )
lab3 = Label(fenetre, text="Nom" , bg = "#290080", fg = "white" )
lab3.place ( x=30 , y=125)
lab4 = Label(fenetre, text="Phone" , bg = "#290080", fg = "white" )
lab4.place ( x=30 , y=150)
lab5 = Label(fenetre, text="Données : " , bg = "#290080", fg = "white" , anchor=W, justify=LEFT)
lab5.place ( x=30 , y=220)
lab6 = Label(fenetre, text="" , bg = "white", fg = "#290080" , anchor=W, justify=LEFT)
lab6.place ( x=130 , y=220)
lab7 = Label(fenetre, text="L'id selectioné est : " , bg = "#290080", fg = "white")
lab7.place ( x=450 , y=220)
listb=Listbox(fenetre, fg = "#290080", width = "10")
listb.place(x = 380, y = 215 )
listb.insert(END, " Prénom ")
listb.itemconfig(0, fg = "black")
# Les entrées
firstname_entry = ttk.Entry(fenetre, width=15, textvariable=firstnamevar)
firstname_entry.place (x = 100 , y = 100 )
#firstname_entry.place_forget()
lastname_entry = ttk.Entry(fenetre, width=15, textvariable=lastnamevar)
lastname_entry.place (x = 100 , y = 125 )
Phone_entry = ttk.Entry(fenetre, width=15, textvariable=Phonevar)
Phone_entry.place (x = 100 , y = 150 )
Phonevar.set("")
scrollbar = Scrollbar(fenetre)
scrollbar.place (x = 670 , y = 170)
# la creation de la TreeView
tv = ttk.Treeview(fenetre, show='headings', height =3, yscrollcommand=scrollbar.set)
tv["columns"]=("Id","col1","col2","col3")
tv.column("Id",width=80,anchor="center", stretch = True, minwidth = 50)
tv.column("col1",width=80,anchor="center", stretch = True, minwidth = 50)
tv.column("col2",width=80,anchor="center")
tv.column("col3",width=110,anchor="center")
tv.heading("Id",text="Id")
tv.heading("col1",text="Prénom")
tv.heading("col2",text="Nom")
tv.heading("col3",text="Phone number")
tv.place( x = 400 , y = 120)
scrollbar.config(command=tv.yview)
effacer = Button(fenetre, text = "Effacer Tv" ) #, command = cleartv)
effacer.place( x=400, y=80 )
afficher = Button(fenetre, text = "Afficher", command = affichimg )#, command = afficher)
afficher.place( x=290, y=80 )
inserer = Button(fenetre, text = "Inserer")# , command = insere )
inserer.place( x=290, y=110 )
modifier = Button(fenetre, text = "Modifier" )
modifier.place( x=290, y=140 )
supprimer = Button(fenetre, text = "Supprimer" )#, command=lambda: on_click(None))
supprimer.place( x=290, y=170 )
Quitter = Button(fenetre, text = "Quitter" , command = fenetre.quit)
Quitter.place( x=200, y=350 )
fenetre.after(0,center,fenetre)
fenetre.mainloop()