I have made a GUI using tkinter and then converted the py file to exe. But some widgets like the DateEntry widget is not visible in the exe file.
I have to submit for board practical.
Related
Trying to use python to programmatically save a PyQt5 QWidget as an image (any format)
Came across a solution here, but this solution more or less saves a screenshot of the widget window, which demands the widget window to be open in the first place
What I'm trying to do is to get the widget to be saved without the GUI window being generated/shown on screen
So to be more precise:
Widget is created with script
Created widget is automatically saved without the UI popping up or external interactions
The widget I'm working with can be found here
Is it possible to get screenshot of certain window and not the entire computer screen?
My window is written with QtDesigner using main window template.The window is use to display results of calculations. How can I take a screenshot of just the one window? Is pyscreenshot able to do this?
I understand that I can do part of the screen using bbox, but if the user moves the window, it won't take the screenshot correctly.
I'm currently using pyscreenshot and it takes a screenshot of entire screen.
I've found a solution based off other posts.
Found in: Python Screenshot of inactive window PrintWindow + win32gui
To solve issue with importing modules, I downloaded pywin32 for python and use these as my imports
import win32gui
import win32ui
from ctypes import windll
from PIL import Image
I am currently stepping through the tkinter tutorial at python-course.eu. Is it possible to close an entry widget without killing the program? What I am trying to do is incorporate the tkinter entry box into a pygame program such that the program asks for the players name via an entry box and then closes once the text has been entered. The game should then continue. Is this possible?
What I would like to do is:
-create a pygame surface
-open a tkinter entry widget on top of that surface
-get the users name
-close the tkinter widget
-write text using pygame onto the surface that incorporates the user's name
What is stumping me is the fact that the tkinter examples on python-course.eu all end with a mainloop() statement while I would like pygame to have an event loop so that I can expand the program. I anticipate that the widget creation would occur prior to dropping into the event loop. This is where I am stuck :-(
rather than trying to mix two GUI libraries in the same window, if a prompt is acceptable you could use:
import tkinter as tk
from tkinter import simpledialog
root = tk.Tk() # needed to prevent extra window being created by dialog
root.withdraw() # hide window as not needed
username = simpledialog.askstring('Username', 'Enter username:')
root.destroy()
I have run into a problem durring abaqus programming with phyton 2.7.
I'm using Tkinter and making a window with a lot of controls on it.
My main problem is that durring my plugin window is opened, the user needs to click on abaqus menuitems, browse modells, etc. So using the main program while my plugin still works on screen.
If I do create my Tk window without thread, than when the user clicks on abaqus main windo functions while my plugin is opened, then abaqus will not respond or crash with "LoadlibraryA error 193"
(example: while plugin runs and user clicks on Viewvport menĂ¼/ViewPort Annotation Options then he/she wont be able to change tabs)
If i do create my Tk window inside a thread, then the al the Tk window controls will only responds the mouse events after I leave the Tk window with my cursor.
(example: I make 2 notebook page and after start i click on the not selected one. then nothing happens until my mous inside the Tk window, but as soon as i move it out, the click takes effect and the tab changes...)
The threaded version of my code:
import threading
class pilotDB(threading.Thread):
def shutdown_ttk_repeat(self):
self.root.eval('::ttk::CancelRepeat')
self.root.destroy()
def __init__(self):
import threading
threading.Thread.__init__(self)
def refresh(self):
self.root.after(50, self.refresh)
def tabpage(self):
import ttk
import sys
self.notebook = ttk.Notebook(self.root)
self.tabpage_tab1 = ttk.Frame(self.notebook,width=400,height=500)
self.tabpage_tab2 = ttk.Frame(self.notebook,width=400,height=500)
self.notebook.add(self.tabpage_tab1, text='Tab1')
self.notebook.add(self.tabpage_tab2, text='Tab2')
self.notebook.place(x=30, y=40)
def run(self):
import Tkinter
self.root = Tkinter.Tk()
self.root.protocol("WM_DELETE_WINDOW", self.shutdown_ttk_repeat)
self.tabpage()
self.root.after(1000, self.refresh())
self.root.mainloop()
app = pilotDB()
app.start()
app/pilotDB has no function named "start" (last line of the code posted). If I put a call to self.run() in init, and delete threading, then the program works as expected, i.e. opens a window and displays 2 tabs and the user can switch between tabs, all the time the mouse is in the window as is normal. Note also that the refresh() function does nothing but call itself repeatedly. You should try to find the offending code by first commenting the lines for the "WM_DELETE_WINDOW", shutdown_ttk_repeat and the call to execute the function tabpage() which leaves a basic window. Then uncomment one and run it, and repeat until you find the error.
I don't want the python icon I want to change my icon
So,how to change my executable file icon
I tried this
from tkinter import *
import os
top=Tk()
os.file.icon('pyt.ico')
top.mainloop()
but it is showing error
Your indentation is wrong. However:
top.wm_iconbitmap('path_to_youricon.ico')