Home Technical Talk

A question for programmers

polycounter lvl 14
Offline / Send Message
PollySong polycounter lvl 14
I know my way around Python, PHP and Java/unity-script, but now I'd like to make standalone .exe's. Specifically I'd like to make an "always on" color library that sits in the (windows) tray and down the line I'd like to make a color picker replacement, like Jovian colorpicker (which I use all the time but that sadly has been discontinued).

What is the best way/programming language to do this? Do I need to learn C++ etc, or can this be done in Python?

Thanks!

Replies

  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Really take your pick, you could use python, but you would need to put pyside and QT ontop of it for handling the UI. I personally think the best option would be to use C# and the .net libraries. Since it has everything you would needed included for making a windows app with a GUI and integration into the system tray.
  • peanut™
    Offline / Send Message
    peanut™ polycounter lvl 18
    Not too sure if this is of any help, but for a color picker in the tray menu there's already a little app for this called colorcop.

    Not that it's better than anything but instead of programming it you could use one made by some else.

    Link:http://color-cop.en.softonic.com/
  • cgBrad
    Offline / Send Message
    cgBrad polycounter lvl 5
    There are a lot of ways you could probably accomplish this. 64bit assembly/C/C++/Java/VB/C#/Python+QT (and more) or something like that. I wish I could make it easier on you, welcome to software engineering.
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    Passerby: Thanks. About Python: If I use a "python2exe" tool, will something like a color picker be noticeably slower in Python than in say C#? Would it be possible to replace the system color picker with python (like Jovian, it suppresses the windows color picker and pops up instead)?

    peanut: Thanks. Jovian is a really good color picker and will work for a while yet, but I'd like to have something a bit more future proof. Also, I wouldn't mind learning to do it myself.
  • Panupat
    Offline / Send Message
    Panupat polycounter lvl 15
    .MET C# would be my pick as well.
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    Ok, thanks. I'll have a look at C#. Could be useful for Unity as well.
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Ya possible via python, just more work. Python2Exe would provide no realy benefit unless you are distributing it to people who don't have python interpreters. Though the amount of work to do this on python is much greater, since python has no gui framework out of the box. So you will have to install the win32 extensions for python as well as gtk+ or qt for the gui. Which can be complicated.

    Where C# will have everything you needed included in the .NET libraries. Also since you mentioned Unity, yes it will help you a lot there too. Since C# is the more powerful of the 2 languages supported by Unity, and unlike Unity's bastardized JavaScript it is a standard and known language that is useful all over and not just in unity.

    Also Visual Studio is a really nice IDE to work in and the 2015 community edition is full featured and free.
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    Thanks!, sounds more and more like C# is the way to go. And thanks for the tip about Visual Studio, I was just now googling around for a C# IDE.
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Cant help you on the form for the color picker, but here is the code to make a system try icon and give it a context menu and a exit button.

    You will want to just create a new Windows Form application in Visual Studio, that will get you started with 1 form, and a Class with a Main() method.

    C# shouldn't be a huge jump for you, since python would have gave you a good grounding in OOP code design, your experience with UnityScript would have taught you about explicit types. Will likly notice that C# is just way more explicit and verbose and how it works.
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    namespace TrayTest
    {
        class SysTrayApp : Form {
            [STAThread]
            static void Main() {
                Application.Run(new SysTrayApp());
            }
    
            private NotifyIcon trayIcon;
            private ContextMenu trayMenu;
    
            public SysTrayApp() {
                trayMenu = new ContextMenu();
                trayMenu.MenuItems.Add("Exit", OnExit);
    
                trayIcon = new NotifyIcon();
                trayIcon.Text = "MyTrayApp";
                trayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);
    
                trayIcon.ContextMenu = trayMenu;
                trayIcon.Visible = true;
            }
    
            protected override void OnLoad(EventArgs e) {
                Visible = false;
                ShowInTaskbar = false;
                base.OnLoad(e);
            }
    
            private void OnExit(object sender, EventArgs e) {
                Application.Exit();
            }
    
            protected override void Dispose(bool disposing) {
                if (disposing) {
                    trayIcon.Dispose();
                }
    
                base.Dispose(disposing);
            }
        }
    }
    
  • marks
    Offline / Send Message
    marks greentooth
    c# / .net / winforms is what I'd recommend.
  • Zhalktis
    Offline / Send Message
    Zhalktis polycounter lvl 2
    C# would likely give you the least headaches in such a case. It's a good useful language for tools and utils overall.

    If you were working in 3ds max, the additional bonus would be that you could write an assembly/dll in C# and load it in 3ds max and use its functions quite easily. Makes for good code reuse.
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    passerby: Very helpful, thanks a lot!

    marks: Thanks.

    Zhalktis: I am using Max at work, but I mostly write python scripts/plugins for modo. I have a few ideas for tools that would be nice to have in Max though, so that would be a bonus.
  • peanut™
    Offline / Send Message
    peanut™ polycounter lvl 18
    PollySong: Thanks i didn't know about Jovian color picker, work directly in photoshop. Have a good one ;)
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    peanut: Glad I could help. Jovian started as a plugin for LightWave, then became standalone (which is when I bought it), then was bought by NewTek and integrated into LightWave/killed as a standalone. It's a shame. But one day I'll make a better one, in a couple of years or so...
  • RN
    Offline / Send Message
    RN sublime tool
    If you intend to make it cross-platform and you have the means to learn C++, writing software with Qt and QtCreator (the IDE) is a breeze.

    http://doc.qt.io/qt-5/qsystemtrayicon.html#details

    It takes time, but I learned with these:
    http://www.polycount.com/forum/showpost.php?p=2318335&postcount=25
  • PollySong
    Offline / Send Message
    PollySong polycounter lvl 14
    Hello again. I'm reviving this thread because I'm stuck.

    I went with C# and it's pretty easy to get the hang of, but I just can't figure out how to replace the windows default color picker. I guess I need to listen for the opening of the default color picker and hook into/hijack that somehow?, but I don't even know what to google for and none of the examples I find online do what I need to do. So, any C# programmers out there that can point me in the right direction?

    Here's what I have so far (UI is not finished in any way, it's thrown together for testing purposes):

    • Color library where you can save/load colors
    • Search for color by name
    • Find similar colors to active color, based on a tolerance input
    • Pick color from screen
    • RGB, HSL, HEX sliders/inputs (so far)
    • A lot more to come (feedback welcome)
    My goal is to make it a complete, but lightweight, color manager that replaces the windows color picker (and other applications' custom color pickers, when I figure out how to do that).


Sign In or Register to comment.