I don't have Net::Oscar installed, but I can tell you that you will probably have trouble using this with Tk, the way you have it written. The first big problem is that you start your thread after Tk has been started. "Tk is NOT thread-safe" means that you can only mix threads and Tk with certain strict rules. The first rule is that the thread must be created before you invoke any Tk statements. Why? Because when the thread gets created, it gets a copy of the main process. If any Tk widgets are in existence, the thread gets a copy of them. Since Tk is not thread-safe, there will be unpredictable behavior as Tk tries to figure out which thread-widget to use.

So you need to setup a design where you create the aimbot thread BEFORE you start writing any Tk code. Then you can use shared-variables to communicate between the main Tk thread, and the aimbot running in the thread. Additionally, you will probably need a timer in the main Tk thread to constantly read the shared variables to see if they have changed.... Tk will NOT be auto-notified if something in the aimbot-thread changes, so you need a timer to constantly scan the shared variables.

So, it probably can be done, with a well thought out combination of shared-variables, timers, threads, and Tk, but it is sure to be a bit of work. My first prototype would be to create the thread first, and put it into a "sleep loop" waiting for a shared variable from main to start it. Then set up the Tk stuff, with buttons to signal the thread. Then in the thread, when you get a signal to start, create your aimbot, and read/write the shared variables. Then in the Tk main thread, display the reads, and send to the aimbot thread thru shared variables.


I'm not really a human, but I play one on earth. flash japh

In reply to Re: using the send_im function in Net::OSCAR in Tk outside of a Net::OSCAR callback by zentara
in thread using the send_im function in Net::OSCAR in Tk outside of a Net::OSCAR callback by fridayjones85

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.