Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App window is all black after py2app #276

Closed
KafkaOnTheShore1981 opened this issue Jan 24, 2020 · 6 comments
Closed

App window is all black after py2app #276

KafkaOnTheShore1981 opened this issue Jan 24, 2020 · 6 comments

Comments

@KafkaOnTheShore1981
Copy link

KafkaOnTheShore1981 commented Jan 24, 2020

(1)environment:Pycharm+macOS Catalina(10.15.2)
(2)code function:adds sequence numbers as a prefix to the names of files in a selected folder.
(3)problem: After .py code has been transformed to .app by the following steps, the window of the app goes all black although the function is ok.
Here is my procedure:
#(1)pip install py2app
#(2)py2applet --make-setup EasyReNamer.py
#(3)python setup.py py2app
then, in dist folder EasyReNamer.app is available. clicked it and the application works except for black screen.
And here is my code:

import os
from tkinter import filedialog
import tkinter as tk
from tkinter import Button

class ReName():
    def __init__(self):
        self.root = tk.Tk()
        self.root['background']='white'
        self.n = 0
        label = tk.Label(self.root, font=("Arial Bold", 15),text='Please select a directory to rename files in the folder:')
        self.label1=tk.Label(self.root)
        label.pack()
        self.btn = Button(self.root, font=("Arial", 15), relief='raised',highlightbackground='orange', text="Click Me", command=self.rename)
        self.btn.pack()

    def widget_position(self,root,width,height):
        self.width=self.root.winfo_screenwidth()
        self.height=self.root.winfo_screenheight()
        x=(self.width-width)/2
        y=(self.height-height)/2
        self.root.geometry('%dx%d+%d+%d' % (width,height,x,y))
        self.root.grid()

    def get_db_configure(self):
        self.root.title('Easy ReNamer Version 1.0')
        self.root.resizable(0, 0)

    def rename(self):
        file_path = filedialog.askdirectory(title='ReNamer')
        self.file_lists = os.listdir(file_path)
        for self.file in self.file_lists.copy():
            self.oldname = file_path + os.sep + self.file
            if os.path.isdir(self.oldname) or self.file.startswith('.'):
                continue
            else:
                self.newname = file_path + os.sep + '(' + str(self.n + 1) + ')' + self.file
                os.rename(self.oldname, self.newname)
                self.n+=1
        self.label1.config(text='{} file(s) renamed'.format(self.n))
        self.label1.pack()
        self.btn.config(state='disabled')
        self.btn.pack()

ins=ReName()
ins.widget_position(ins.get_db_configure(),500,80)
ins.root.mainloop()

Please tell me what's wrong with it and how to fix the problem. Thank you!

@Hato1
Copy link

Hato1 commented Feb 2, 2020

I'm having the same problem on Mojave (10.14.6). My game using Pygame runs fine other than the display being blank (grey in light mode, black in dark mode). I believe this is bug may have been introduced with OSX Mojave and is related to pygame/pygame#555.
Are you able to test with an older mac version?

@ronaldoussoren
Copy link
Owner

I haven't had time to try to reproduce this issue yet. Does running the application from the terminal show any errors (that is start, "EasyReNamer.app/Contents/MacOS/EasyReNamer")?

@Hato1
Copy link

Hato1 commented Feb 4, 2020

No errors for me. I've since tested the .app that was created on my machine on an older version of mac (high sierra), ran perfectly.

ronaldoussoren added a commit that referenced this issue Feb 4, 2020
@ronaldoussoren
Copy link
Owner

I can reproduce the issue on my machine, both with a regular build and with an alias build.

@ronaldoussoren
Copy link
Owner

The current tip of the tree should fix the issue (fix introduced in 56bec23).

Could you please test if this actually fixes the issue for you? If it does I'll cut a release later this week.

@ronaldoussoren
Copy link
Owner

I'm pretty sure this is fixed in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants